1
1
mirror of https://github.com/StanGirard/quivr.git synced 2024-12-15 21:53:59 +03:00
quivr/frontend/lib/context/BrainProvider/hooks/useBrainContext.ts

15 lines
366 B
TypeScript
Raw Normal View History

import { useContext } from "react";
import { BrainContext } from "../brain-provider";
import { BrainContextType } from "../types";
export const useBrainContext = (): BrainContextType => {
const context = useContext(BrainContext);
if (context === undefined) {
throw new Error("useBrainContext must be used inside BrainProvider");
}
return context;
};