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 helper methods to manage the current active session.
useUser() returns
isSignedIn boolean
A boolean that returns true if the user is signed in.
isLoaded boolean
A boolean that until OneAuxilia loads and initializes, will be set to false. Once OneAuxilia loads, isLoaded will be set to true.
user User
The User object for the currently active user. If the user is not signed in, user will be null.
How to use the useUser() hook
Retrieve the current user data with the useUser() hook
The following example demonstrates how to use the useUser() hook to access the user object, which includes the current user's data, like the user's full name. The isLoaded and isSignedIn properties are used to handle the loading state and to check if the user is signed in, respectively.
For more information on the User object, see the reference.
Update the current user data with the useUser() hook
The following example demonstrates how to use the useUser() hook to access the user object, which includes the update method for updating the user's data.
For more information on the update() method, see the User reference.
Reload user data with the useUser() hook
To retrieve the latest user data after updating the user elsewhere, use the user.reload() method.
For more information on the reload() method, see the User reference.
Last updated