quivr/frontend/lib/context/MenuProvider/hooks/useMenuContext.tsx
Stan Girard d0b8b797f6
feat(search): new way to interact with Quivr (#2026)
Co-authored-by: Zewed <dewez.antoine2@gmail.com>
Co-authored-by: Antoine Dewez <44063631+Zewed@users.noreply.github.com>
2024-01-19 20:34:30 -08:00

14 lines
376 B
TypeScript

import { useContext } from "react";
import { MenuContext } from "../Menu-provider";
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export const useMenuContext = () => {
const context = useContext(MenuContext);
if (context === undefined) {
throw new Error("useMenuContext must be used within a MenuProvider");
}
return context;
};