You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
389 B
19 lines
389 B
2 years ago
|
import { createContext, useContext } from "react";
|
||
|
|
||
|
const NavbarContext = createContext<{
|
||
|
showed: boolean;
|
||
|
show: (showed: boolean) => void;
|
||
|
} | null>(null);
|
||
|
|
||
|
export function useNavbar() {
|
||
|
const context = useContext(NavbarContext);
|
||
|
|
||
|
if (context === null) {
|
||
|
throw new Error("NavbarShowedContext not initialized");
|
||
|
}
|
||
|
|
||
|
return context;
|
||
|
}
|
||
|
|
||
|
export default NavbarContext.Provider;
|