Authentication status¶
Introduction¶
To get the information of whether the user is authenticated or not, React Auth Kit
comes with isAuth
functions
IsAuth
functionality available in both hook
and Higher Order Component
- For Functional Components, you can use
useIsAuthenticated()
hook inside any components - For class-based components, you can wrap the component inside
withIsAuthenticated()
HOC function.
Hook¶
Check the authentication status
in React Functional Components(FC) by adding the useIsAuthenticated
hook inside it.
Import¶
Import useIsAuthenticated in your app | |
---|---|
Demo¶
Component.js | |
---|---|
Higher Order Component¶
Import¶
Import withAuthUser in your app | |
---|---|
Usage¶
component.jsx | |
---|---|
API¶
— 🔑 —
React Auth Kit is Apache 2.0 License code