# useWeb3AuthDisconnect

> @web3auth/modal React Hooks useWeb3AuthDisconnect | Embedded Wallets

Hook to disconnect from Embedded Wallets.

### Import

```tsx

```

### Usage

```tsx

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

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

### Return type

```tsx

```

#### `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.
