16 lines
314 B
JavaScript
16 lines
314 B
JavaScript
|
import { useContext, createContext } from 'react'
|
||
|
|
||
|
export const RootContext = createContext()
|
||
|
|
||
|
export function RootProvider ({ root, children }) {
|
||
|
return (
|
||
|
<RootContext.Provider value={root}>
|
||
|
{children}
|
||
|
</RootContext.Provider>
|
||
|
)
|
||
|
}
|
||
|
|
||
|
export function useRoot () {
|
||
|
return useContext(RootContext)
|
||
|
}
|