mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-14 13:19:05 +03:00
3ba2c92b50
* refactor(MultipleBrain): separate providing and data fetching * refactor(MultipleBrain): update useBrainApi * feat(MultipleBrains): remove unnecessary data fetchings * test(useBrainApi): update unit tests
25 lines
519 B
TypeScript
25 lines
519 B
TypeScript
"use client";
|
|
|
|
import { createContext } from "react";
|
|
|
|
import { useBrainProvider } from "./hooks/useBrainProvider";
|
|
import { BrainContextType } from "./types";
|
|
|
|
export const BrainContext = createContext<BrainContextType | undefined>(
|
|
undefined
|
|
);
|
|
|
|
export const BrainProvider = ({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode;
|
|
}): JSX.Element => {
|
|
const brainProviderUtils = useBrainProvider();
|
|
|
|
return (
|
|
<BrainContext.Provider value={brainProviderUtils}>
|
|
{children}
|
|
</BrainContext.Provider>
|
|
);
|
|
};
|