# useSession()

The `useSession()` hook provides access to the current user's [Session](https://clerk.com/docs/expo/reference/objects/session.md) object, as well as helpers for setting the active session.

## Returns

There are multiple variants of this type available which you can select by clicking on one of the tabs.

**Loading**

| Name         | Type        | Description                                                                                                                                                                                                                                                                                                       |
| ------------ | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `isLoaded`   | `false`     | Indicates whether Clerk has loaded the current authentication state. Initially `false`, becomes `true` once Clerk loads, and can revert to `false` while auth state is updating (for example, when switching organizations via [setActive()](https://clerk.com/docs/expo/reference/objects/clerk.md#set-active)). |
| `isSignedIn` | `undefined` | Indicates whether a user is currently signed in.                                                                                                                                                                                                                                                                  |
| `session`    | `undefined` | The current session for the user.                                                                                                                                                                                                                                                                                 |

**Signed out**

| Name         | Type    | Description                                                                                                                                                                                                                                                                                                       |
| ------------ | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `isLoaded`   | `true`  | Indicates whether Clerk has loaded the current authentication state. Initially `false`, becomes `true` once Clerk loads, and can revert to `false` while auth state is updating (for example, when switching organizations via [setActive()](https://clerk.com/docs/expo/reference/objects/clerk.md#set-active)). |
| `isSignedIn` | `false` | Indicates whether a user is currently signed in.                                                                                                                                                                                                                                                                  |
| `session`    | `null`  | The current session for the user.                                                                                                                                                                                                                                                                                 |

**Signed in**

| Name         | Type                                                                                | Description                                                                                                                                                                                                                                                                                                       |
| ------------ | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `isLoaded`   | `true`                                                                              | Indicates whether Clerk has loaded the current authentication state. Initially `false`, becomes `true` once Clerk loads, and can revert to `false` while auth state is updating (for example, when switching organizations via [setActive()](https://clerk.com/docs/expo/reference/objects/clerk.md#set-active)). |
| `isSignedIn` | `boolean`                                                                           | Indicates whether a user is currently signed in.                                                                                                                                                                                                                                                                  |
| `session`    | [SignedInSessionResource](https://clerk.com/docs/expo/reference/objects/session.md) | The current session for the user.                                                                                                                                                                                                                                                                                 |

## Example

### Access the `Session` object

The following example uses the [useSession()](https://clerk.com/docs/expo/reference/hooks/use-session.md) hook to access the [Session](https://clerk.com/docs/expo/reference/objects/session.md) object. The `Session` object is used to access the `lastActiveAt` property, which is a `Date` object used to show the time the session was last active.

filename: src/app/(session)/page.tsx
```tsx
import { useSession } from '@clerk/expo'
import { Text, View } from 'react-native'

export default function HomePage() {
  const { isLoaded, session, isSignedIn } = useSession()

  // Handle loading state
  if (!isLoaded)
    return (
      <View>
        <Text>Loading...</Text>
      </View>
    )

  // Protect the page from unauthenticated users
  if (!isSignedIn)
    return (
      <View>
        <Text>Sign in to view this page</Text>
      </View>
    )

  return (
    <View>
      <Text>This session has been active since {session.lastActiveAt.toLocaleString()}</Text>
    </View>
  )
}
```

---

## Sitemap

[Overview of all docs pages](https://clerk.com/docs/llms.txt)
