Created
April 3, 2022 19:01
-
-
Save toots/453ff3375f7cec582069bc3c0bac798c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface SearchContextType { | |
show: boolean | |
setShow: (_: boolean) => void | |
query: string | |
setQuery: (_: string) => void | |
} | |
const SearchContext = createContext<SearchContextType>({} as SearchContextType) | |
export const SearchProvider = ({ children }: { children: React.ReactNode }) => { | |
const [show, setShow] = useState(false) | |
const [query, setQueryState] = useState('') | |
const router = useRouter() | |
return ( | |
<SearchContext.Provider value={{ show, setShow, query, setQuery }}> | |
{children} | |
</SearchContext.Provider> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment