Custom React hook to access the authentication context.
Throws an error if used outside of an AuthProvider.
The current authentication context value.
export function useAuth(): AuthContextType { const context = useContext(AuthContext); if (context === undefined) { throw new Error("useAuth must be used within an AuthProvider"); } return context;} Copy
export function useAuth(): AuthContextType { const context = useContext(AuthContext); if (context === undefined) { throw new Error("useAuth must be used within an AuthProvider"); } return context;}
Custom React hook to access the authentication context.
Throws an error if used outside of an AuthProvider.