useIsAuthenticated¶
Import¶
Function Signature¶
useIsAuthenticated(): () => boolean
Is Authenticated, React Hook
Call the hook to know if the user is authenticated or not
This uses the context data to determine whether the user is authenticated or not.
Returns¶
fn
=> (): boolean
Example¶
import useIsAuthenticated from 'react-auth-kit/hooks/useIsAuthenticated'
const Component = () => {
const isAuthenticated = useIsAuthenticated()
if (isAuthenticated()) {
// user authenticated - do somthing
}
else {
// user not authenticated
}
Throws¶
AuthError - Thrown if the Hook is used outside the Provider Scope.
Defined in¶
— 🔑 —
React Auth Kit is MIT License code