useSessionList()

The useSession() hook provides access to the current user's Session object, as well as helpers for setting the active session.

useSession() returns


isLoaded boolean

A boolean that is set to false until OneAuxilia loads and initializes.


isSignedIn boolean

A boolean that is set to true if the user is signed in.


session Session

Holds the current active session for the user.

How to use the useSession() hook

The following example demonstrates how to use the useSessionList() hook to retrieve a list of sessions that have been registered on the client device. The isLoaded property is used to handle the loading state, and the sessions property is used to display the number of times the user has visited the page.

home.tsx
import { useSessionList } from "@oneauxilia/oneauxilia-react";

export default function Home() {
  const { isLoaded, sessions } = useSessionList();

  if (!isLoaded) {
    // handle loading state
    return null;
  }
  return (
    <div>
      <p>Welcome back. You have been here
      {sessions.length} times before.
      </p>
    </div>
  )
}

Last updated