import { ReactNode, createContext, useState } from "react"; interface LayoutContextType { leftNav: boolean; theme: string; update: (fn: (c: LayoutContextType) => LayoutContextType) => void; } const defaultLayoutContext: LayoutContextType = { leftNav: true, theme: "", update: c => c, }; export const LayoutContext = createContext(defaultLayoutContext); export function LayoutContextProvider({ children }: { children: ReactNode }) { const [value, setValue] = useState(defaultLayoutContext); return ( { setValue(fn); }, }}> {children} ); }