2023-06-20 17:17:13 +03:00
|
|
|
"use client";
|
|
|
|
|
2023-07-05 10:30:22 +03:00
|
|
|
import { createContext } from "react";
|
|
|
|
|
2023-07-07 13:56:08 +03:00
|
|
|
import { useBrainProvider } from "./hooks/useBrainProvider";
|
2023-07-05 10:30:22 +03:00
|
|
|
import { BrainContextType } from "./types";
|
|
|
|
|
|
|
|
export const BrainContext = createContext<BrainContextType | undefined>(
|
|
|
|
undefined
|
|
|
|
);
|
2023-06-20 17:17:13 +03:00
|
|
|
|
|
|
|
export const BrainProvider = ({
|
|
|
|
children,
|
|
|
|
}: {
|
|
|
|
children: React.ReactNode;
|
|
|
|
}): JSX.Element => {
|
2023-07-07 13:56:08 +03:00
|
|
|
const brainProviderUtils = useBrainProvider();
|
2023-06-20 17:17:13 +03:00
|
|
|
|
|
|
|
return (
|
2023-07-07 13:56:08 +03:00
|
|
|
<BrainContext.Provider value={brainProviderUtils}>
|
|
|
|
{children}
|
|
|
|
</BrainContext.Provider>
|
2023-06-20 17:17:13 +03:00
|
|
|
);
|
|
|
|
};
|