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;
};