Spaces:
Runtime error
Runtime error
File size: 523 Bytes
56b6519 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import { createContext, PropsWithChildren, useContext, useState } from 'react';
const AuthContext = createContext<boolean | null>(null);
type AuthProviderProps = PropsWithChildren & {
isSignedIn?: boolean;
};
const AuthProvider = ({ children, isSignedIn }: AuthProviderProps) => {
const [user] = useState<boolean | null>(isSignedIn ? true : null);
return <AuthContext.Provider value={user}>{children}</AuthContext.Provider>;
};
export const useAuth = () => useContext(AuthContext);
export default AuthProvider;
|