2023-06-20 17:17:13 +03:00
|
|
|
"use client";
|
|
|
|
|
2023-07-05 10:30:22 +03:00
|
|
|
import { createContext } from "react";
|
|
|
|
|
2023-06-20 17:17:13 +03:00
|
|
|
import { useBrainState } from "./hooks/useBrainState";
|
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 => {
|
|
|
|
const brainState = useBrainState();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<BrainContext.Provider value={brainState}>{children}</BrainContext.Provider>
|
|
|
|
);
|
|
|
|
};
|