mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-23 22:40:50 +01:00
15 lines
524 B
TypeScript
15 lines
524 B
TypeScript
|
import { createContext, FC, useContext } from 'react';
|
||
|
import { INavigatorContext, NavigatorContextProps } from './NavigatorContext.types';
|
||
|
|
||
|
const NavigatorContext = createContext<INavigatorContext>({
|
||
|
navigatorState: null,
|
||
|
dispatchNavigatorState: null
|
||
|
});
|
||
|
|
||
|
export const NavigatorContextProvider: FC<NavigatorContextProps> = props =>
|
||
|
{
|
||
|
return <NavigatorContext.Provider value={ props.value }>{ props.children }</NavigatorContext.Provider>
|
||
|
}
|
||
|
|
||
|
export const useNavigatorContext = () => useContext(NavigatorContext);
|