> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polygon.technology/llms.txt
> Use this file to discover all available pages before exploring further.

# useSequenceSessionState

> Hook to access embedded wallet and session state information.

## Import

```tsx theme={null}
import { useSequenceSessionState } from '@0xsequence/connect'
```

## Usage

```tsx theme={null}
import { useSequenceSessionState } from '@0xsequence/connect'

function App() {
  const sessionState = useSequenceSessionState()

  // Check if sessions are initialized
  if (!sessionState.isInitialized) {
    return <div>Session state is not initialized</div>
  }

  return (
    <div>
      <p>Wallet: {sessionState.walletAddress}</p>
      <p>Login Method: {sessionState.loginMethod}</p>
      <p>User Email: {sessionState.userEmail}</p>
      <p>Number of active explicit sessions: {sessionState.sessions.filter(s => s.type === 'explicit').length}</p>
    </div>
  )
}
```

## Return Type

```tsx theme={null}
interface SessionState {
  isInitialized: boolean
  walletAddress: `0x${string}` | null
  sessions: Session[]
  loginMethod: string | null
  userEmail: string | null
}
```

| Property        | Type                        | Description                                                                             |
| --------------- | --------------------------- | --------------------------------------------------------------------------------------- |
| `isInitialized` | `boolean`                   | Whether the session data is ready. Always check this before accessing other properties. |
| `walletAddress` | `` `0x${string}` \| null `` | The connected wallet address, or `null` if not connected.                               |
| `sessions`      | `Session[]`                 | Array of active sessions. Each session has a `type` of `'implicit'` or `'explicit'`.    |
| `loginMethod`   | `string \| null`            | The authentication method used.                                                         |
| `userEmail`     | `string \| null`            | The associated email address, if any.                                                   |

## Checking Session Types

```tsx theme={null}
import { useSequenceSessionState } from '@0xsequence/connect'

function SessionStatus() {
  const sessionState = useSequenceSessionState()

  if (!sessionState.isInitialized) {
    return <div>Loading session...</div>
  }

  const hasSessions = sessionState.sessions.length > 0
  const hasImplicitSession = sessionState.sessions.some(s => s.type === 'implicit')
  const hasExplicitSession = sessionState.sessions.some(s => s.type === 'explicit')

  return (
    <div>
      <h3>Session Status</h3>
      <p>Initialized: {sessionState.isInitialized ? 'Yes' : 'No'}</p>
      <p>Wallet: {sessionState.walletAddress || 'Not connected'}</p>
      <p>Has Sessions: {hasSessions ? 'Yes' : 'No'}</p>
      <p>Has Implicit Session: {hasImplicitSession ? 'Yes' : 'No'}</p>
      <p>Has Explicit Session: {hasExplicitSession ? 'Yes' : 'No'}</p>
      <p>Login Method: {sessionState.loginMethod || 'Unknown'}</p>
      <p>User Email: {sessionState.userEmail || 'Not available'}</p>
    </div>
  )
}
```

This hook automatically updates when session information changes.
