Function DraftsContextProvider

  • React Component that provides the context for the useDrafts() hook to be used by components further down your component tree. It should only be included in your component tree once and ideally at the root of the application.

    Example

    import * as React from 'react'
    import { DraftsContextProvider, useDrafts } from '@oneblink/apps-react'

    function Component() {
    const draftsContext = useDrafts()
    // use drafts here
    }

    function App() {
    return (
    <DraftsContextProvider>
    <Component />
    </DraftsContextProvider>
    )
    }

    const root = document.getElementById('root')
    if (root) {
    ReactDOM.render(<App />, root)
    }

    Parameters

    • props: {
          children: ReactNode;
          formsAppId: number;
          isDraftsEnabled: boolean;
      }
      • children: ReactNode
      • formsAppId: number
      • isDraftsEnabled: boolean

    Returns Element