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.
useDrafts()
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)} Copy
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)}
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