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

# useWeb3Auth

Hook to access the Web3Auth context.

### Import[​](#import "Direct link to Import")

```
import { useWeb3Auth } from '@web3auth/modal/react'

```

### Usage[​](#usage "Direct link to Usage")

```
import { useWeb3Auth } from '@web3auth/modal/react'

function App() {
  const { web3Auth, isConnected, isInitializing, connection, status, initError } = useWeb3Auth()

  if (isConnected) {
    console.log('Connected via:', connection?.connectorName)
  }
  if (isInitializing) {
    console.log('Web3Auth is initializing')
  }
  if (connection?.ethereumProvider) {
    // Use for JSON-RPC edge cases; prefer Wagmi hooks for standard EVM flows
    console.log('Ethereum provider available')
  }
  if (status) {
    console.log('Web3Auth status:', status)
  }
  if (initError) {
    console.log('Web3Auth initialization error:', initError)
  }
}

```

info

For EVM wallet operations, use [Wagmi hooks](/embedded-wallets/sdk/react/ethereum-hooks/) (`useAccount`, `useBalance`, `useSendTransaction`) after setting up `WagmiProvider`. Use `connection.ethereumProvider` only for JSON-RPC methods Wagmi does not cover. See the [Web SDK v11 migration guide](/embedded-wallets/migration-guides/web/#provider-api-changes-all-frameworks).

### Return type[​](#return-type "Direct link to Return type")

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

```

#### `connection`[​](#connection "Direct link to connection")

`{ ethereumProvider, solanaWallet, connectorName } | null`

Active wallet connection after sign-in. `ethereumProvider` is an EIP-1193 provider for EVM; `solanaWallet` exposes Solana wallet utilities.

#### `initError`[​](#initerror "Direct link to initerror")

`Error | null`

Error that occurred during Web3Auth initialization.

#### `isConnected`[​](#isconnected "Direct link to isconnected")

`boolean`

Whether the user is connected to Web3Auth.

#### `isInitialized`[​](#isinitialized "Direct link to isinitialized")

`boolean`

Whether Web3Auth has completed initialization.

#### `isInitializing`[​](#isinitializing "Direct link to isinitializing")

`boolean`

Whether Web3Auth is currently initializing.

#### `status`[​](#status "Direct link to status")

`string`

Current status of the Web3Auth connection.

#### `web3Auth`[​](#web3auth "Direct link to web3auth")

`Web3Auth`

The Web3Auth instance.

#### `getPlugin`[​](#getplugin "Direct link to getplugin")

`(pluginName: PLUGIN_NAME) => IPlugin | null`

Helper function to get a plugin by name.
