mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-18 03:41:44 +03:00
9bb7ccf651
* feat: add providers mocks * test(<ChatPage/>: add render test using providers
15 lines
371 B
TypeScript
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;
|
|
};
|