committed by
Sacha Al Himdani
parent
44898be9d3
commit
55e85e5f67
13
apps/trust/src/providers/AuthProvider.tsx
Normal file
13
apps/trust/src/providers/AuthProvider.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import { createContext, useMemo } from "react";
|
||||
|
||||
export const AuthContext = createContext({ isAuthenticated: false });
|
||||
|
||||
type Props = {
|
||||
children: React.ReactNode;
|
||||
isAuthenticated: boolean;
|
||||
};
|
||||
|
||||
export function AuthProvider({ children, isAuthenticated }: Props) {
|
||||
const value = useMemo(() => ({ isAuthenticated }), [isAuthenticated]);
|
||||
return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>;
|
||||
}
|
||||
Reference in New Issue
Block a user