quivr/frontend/lib/context/BrainProvider/hooks/useBrainContext.ts
Mamadou DICKO 9bb7ccf651
Frontend/test/chat 1 (#508)
* feat: add providers mocks

* test(<ChatPage/>: add render test using providers
2023-07-05 09:30:22 +02:00

15 lines
371 B
TypeScript

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