> For the complete documentation index, see [llms.txt](/llms.txt).

# useWeb3AuthDisconnect

Hook to sign the user out and end the current session.

### Import

```tsx
import { useWeb3AuthDisconnect } from '@web3auth/react-native-sdk'

```

### Usage

```tsx
import { useWeb3AuthDisconnect } from '@web3auth/react-native-sdk'
import { Button, Text, View } from 'react-native'

function LogoutButton() {
  const { disconnect, loading, error } = useWeb3AuthDisconnect()

  return (
    <View>
      <Button
        title={loading ? 'Signing out…' : 'Sign out'}
        disabled={loading}
        onPress={() => disconnect()}
      />
      {error && <Text>{error.message}</Text>}
    </View>
  )
}

```

### Return type

```tsx
import { type IUseWeb3AuthDisconnect } from '@web3auth/react-native-sdk'

```

#### `disconnect`

`() => Promise<void>`

Invalidates the session on the server and removes it from device storage. After it resolves, `useWeb3Auth().isConnected` is `false` and `connection` is `null`. If no user is signed in, `disconnect` sets `error` instead of throwing.

#### `loading`

`boolean`

`true` while sign-out is in progress.

#### `error`

`Web3authRNError | null`

Error from the most recent `disconnect` call, or `null`.
