useUser
The useUser hook is a convenient way to access the current user data where you need it. This hook provides the user data and authorize method to manage the current active user.
Authorize
Register User
When user is registered, the user’s uuid will be storied in the storage. This will allow to identify the user in the future. Please note that you also need to store it in the database in case the user clears the storage.
Authorize existing user
You can use stored users uuid to authorize the user.
Authorized User
You can get the current authorized user by using the user
property.
The useUser
hook returns the current user object, which includes the name and email properties. If no user is currently logged in, the hook will return null.
You can use the useUser
hook anywhere within a component tree that is wrapped in the UseawardsProvider. If there is no UseawardsProvider in the tree, the useUser hook will throw an error.