Created
April 3, 2022 19:04
-
-
Save toots/98b3e0a1b35412b44b4bd51af248371d 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