@oneschema/filefeeds-react
v0.5.2
Published
React component for embedding OneSchema FileFeeds
Downloads
2,570
Keywords
Readme
A tool for embedding OneSchema FileFeeds into your application with React.
This library contains a React component which will allow you to add an iframe to your application which can create new OneSchema FileFeeds and edit their transforms.
Getting Started
Installation
You can install this package with npm:
npm i --save @oneschema/filefeeds-react
Sample usage
import React, { useState } from "react"
import OneSchemaFileFeeds from "@oneschema/filefeeds-react"
function OneSchemaFileFeedsExample() {
const [isOpen, setIsOpen] = useState(false)
const handleData = (data) => {
console.log(data)
}
return (
<div>
<button onClick={() => setIsOpen(true)}>Open the file feed transforms</button>
<OneSchemaFileFeeds
/* managing state from your application */
isOpen={isOpen}
/* required config values */
userJwt={userJwt}
/* optional config values */
devMode={process.env.NODE_ENV !== "production"}
style={{
position: "fixed",
top: 0,
left: 0,
width: "100vw",
height: "100vh",
}}
inline={false}
/* handling results */
onInitFail={(data) => updateStatus("Initialization failed.", data)}
onInitSucceed={(data) => {
setSessionId(data.sessionId)
updateStatus("Initialization succeeded.", data)
}}
onSave={(data) => updateStatus("Saved.", data)}
/>
</div>
)
}
Documentation
Please see 📚 OneSchema's documentation for ▶️ Getting Started, 📒 API reference and other helpful guides.