import {createPageContext, usePageContextReducer} from '@hooks';
import {ChildrenFC} from '@utils';

type Props = {
  context: ReturnType<typeof createPageContext>
};

const PageProvider: ChildrenFC<Props> = function({children, context}) {
  const state = usePageContextReducer();
  const {Provider} = context;

  return <Provider value={state}>{children}</Provider>;
};

export default PageProvider;
