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

# useWeb3AuthDisconnect

Hook to disconnect from Embedded Wallets.

### Import

```tsx
import { useWeb3AuthDisconnect } from '@web3auth/modal/react'

```

### Usage

```tsx
import { useWeb3AuthDisconnect } from '@web3auth/modal/react'

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

  return (
    <div>
      <button onClick={() => disconnect()} disabled={loading}>
        {loading ? 'Disconnecting...' : 'Disconnect'}
      </button>
      {error && <div>{error.message}</div>}
    </div>
  )
}

```

### Return type

```tsx
import { type IUseWeb3AuthDisconnect } from '@web3auth/modal/react'

```

#### `loading`

`boolean`

Whether the disconnection process is in progress.

#### `error`

`Web3AuthError | null`

Error that occurred during the disconnection process.

#### `disconnect`

`(options?: { cleanup: boolean }) => Promise<void>`

Function to initiate the disconnection process. Optional `cleanup` parameter controls whether to remove all user data.
