nitro-react/src/views/navigator/context/NavigatorContext.tsx

15 lines
524 B
TypeScript
Raw Normal View History

2021-05-05 00:38:31 +02:00
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);