import { signal, Signal } from "@preact/signals"; import { createContext, JSX } from "preact"; import { useContext } from "preact/hooks"; interface AppContextValue { isLoggedIn: Signal; } const AppContext = createContext({ isLoggedIn: signal(false), }); const AppProvider = ({ children }: { children: JSX.Element }) => { const value: AppContextValue = { isLoggedIn: signal(false), }; return {children}; }; const useAppContext = () => { const context = useContext(AppContext); if (!context) { throw new Error("useAppContext must be used within AppProvider"); } return context; }; export { AppProvider, useAppContext };