useSession()
The useSession()
hook provides access to the current user's Session
object, as well as helpers for setting the active session.
useSession()
returns
- Name
isLoaded
- Type
boolean
- Description
A boolean that is set to
false
until Clerk loads and initializes.
- Name
isSignedIn
- Type
boolean
- Description
A boolean that is set to
true
if the user is signed in.
- Name
session
- Type
Session
- Description
Holds the current active session for the user.
How to use the useSession()
hook
The following example demonstrates how to use the useSession()
hook to access the SignIn
object, which has the lastActiveAt
property on it. The lastActiveAt
property is used to display the last active time of the current session to the user.
Feedback
Last updated on