import {createSearchContext, useSearchContextReducer} from '@hooks';
import {ChildrenFC} from '@utils';

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

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

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

export default SearchProvider;
