Hooks are React functions that provide access to wallet connection features, modal controls, blockchain interactions, and wallet event subscriptions. They enable you to manage wallet connections, handle user authentication, interact with smart contracts, and respond to wallet events in your application.

useAppKit

The primary hook for controlling the modal’s visibility and behavior. Use this hook when you need to programmatically open or close the modal, or when you want to show specific views like the connection screen or account details.

import { useAppKit } from "@reown/appkit/react";

export default function Component() {
  const { open, close } = useAppKit();
}

Use Cases

  • Opening the modal when a user clicks a “Connect Wallet” button
  • Closing the modal after a successful connection
  • Opening specific views of the modal (e.g., account view, connect view)
  • Handling custom wallet connection flows

Returns

  • open: Function to open the modal
  • close: Function to close the modal

Parameters

You can also select the modal’s view when calling the open function

open({ view: "Account" });

// to connect and show multi wallets view
open({ view: "Connect" });

// to connect and show only solana wallets
open({ view: "Connect", namespace: "solana" });

// to connect and show only bitcoin wallets
open({ view: "Connect", namespace: "bip122" });

// to connect and show only ethereum wallets
open({ view: "Connect", namespace: "eip155" });

// to open swap with arguments
open({
  view: 'Swap',
  arguments: {
    amount: '321.123',
    fromToken: 'USDC',
    toToken: 'ETH'
  }
})

List of views you can select

VariableDescription
ConnectPrincipal view of the modal - default view when disconnected. A namespace can be selected to connect to a specific network (solana, bip122 or eip155)
AccountUser profile - default view when connected
AllWalletsShows the list of all available wallets
NetworksList of available networks - you can select and target a specific network before connecting
WhatIsANetwork”What is a network” onboarding view
WhatIsAWallet”What is a wallet” onboarding view
OnRampProvidersOn-Ramp main view
SwapSwap main view

useAppKitAccount

The essential hook for accessing wallet connection state and user information. Use this hook whenever you need to know if a user is connected, get their wallet address, or access their embedded wallet details.

import { useAppKitAccount } from "@reown/appkit/react";

const { address, isConnected, caipAddress, status, embeddedWalletInfo } =
  useAppKitAccount();

Use Cases

  • Displaying the connected wallet address in your UI
  • Checking if a user is connected before showing certain features
  • Getting user information for embedded wallets
  • Handling multi-chain scenarios where you need account info for specific chains

Hook for accessing account data and connection status for each namespace when working in a multi-chain environment.

import { useAppKitAccount } from "@reown/appkit/react";

const eip155Account = useAppKitAccount({ namespace: "eip155" }); // for EVM chains
const solanaAccount = useAppKitAccount({ namespace: "solana" });
const bip122Account = useAppKitAccount({ namespace: "bip122" }); // for bitcoin

Returns

  • allAccounts: A list of connected accounts
  • address: The current account address
  • caipAddress: The current account address in CAIP format
  • isConnected: Boolean that indicates if the user is connected
  • status: The current connection status
  • embeddedWalletInfo: The current embedded wallet information
type EmbeddedWalletInfo {
  user: {
    username: string
    email: string
  },
  accountType: 'eoa' | 'smartAccount',
  authProvider: 'google' | 'apple' | 'facebook' | 'x' | 'discord' | 'farcaster' | 'github' | 'email',
  isSmartAccountDeployed: boolean
}

type ConnectionStatus = 'connected' | 'disconnected' | 'connecting' | 'reconnecting'

type UseAppKitAccountReturnType = {
  isConnected: boolean
  allAccounts: Account[]
  status?: ConnectionStatus
  address?: string
  caipAddress?: `${string}:${string}`
  embeddedWalletInfo?: EmbeddedWalletInfo
}

useAppKitNetwork

The network management hook that provides access to chain information and network switching capabilities. Use this hook when you need to display the current network, switch between networks, or validate network compatibility.

import { useAppKitNetwork } from "@reown/appkit/react";

export default Component(){
  const { caipNetwork, caipNetworkId, chainId, switchNetwork } = useAppKitNetwork()
}

Use Cases

  • Displaying the current network/chain in your UI
  • Switching networks when a user selects a different chain
  • Validating if a user is on the correct network for your dApp
  • Handling network-specific features or contracts

Returns

  • caipNetwork: The current network object
  • caipNetworkId: The current network id in CAIP format
  • chainId: The current chain id
  • switchNetwork: Function to switch the network. Accepts a caipNetwork object as argument.

See how to import or create a networks here.

useAppKitState

The state management hook that provides real-time access to the modal’s current state. Use this hook when you need to react to modal state changes or synchronize your UI with the modal’s status.

import { useAppKitState } from "@reown/appkit/react";

const { open, selectedNetworkId } = useAppKitState();

Use Cases

  • Syncing your UI with the modal’s open/closed state
  • Tracking which network the user has selected
  • Creating custom UI elements that respond to modal state changes
  • Implementing custom loading states based on modal state

Returns

  • open: Boolean that indicates if the modal is open
  • selectedNetworkId: The current chain id selected by the user

useAppKitTheme

The theming hook that controls the visual appearance of the modal. Use this hook when you need to customize the modal’s colors, implement dark/light mode, or match the modal’s appearance with your application’s theme.

import { useAppKitTheme } from "@reown/appkit/react";
const { themeMode, themeVariables, setThemeMode, setThemeVariables } =
  useAppKitTheme();

setThemeMode("dark");

setThemeVariables({
  "--w3m-color-mix": "#00BB7F",
  "--w3m-color-mix-strength": 40,
});

Use Cases

  • Implementing dark/light mode in your dApp
  • Customizing the modal’s appearance to match your brand
  • Creating theme-specific UI elements
  • Syncing the modal’s theme with your app’s theme

useAppKitEvents

The event subscription hook that allows you to listen to modal and wallet events. Use this hook when you need to track user interactions, implement analytics, or respond to specific wallet events in your application.

import { useAppKitEvents } from "@reown/appkit/react";

const events = useAppKitEvents();

Use Cases

  • Tracking user interactions with the modal
  • Implementing analytics for wallet connections
  • Creating custom notifications for connection events
  • Handling specific wallet events in your application

useDisconnect

The session management hook that handles wallet disconnection. Use this hook when implementing logout functionality or when you need to clean up resources after a user disconnects their wallet.

import { useDisconnect } from "@reown/appkit/react";

const { disconnect } = useDisconnect();

await disconnect();

Use Cases

  • Implementing a “Disconnect Wallet” button
  • Handling logout flows in your application
  • Cleaning up resources when a user disconnects
  • Resetting application state after disconnection

useWalletInfo

The wallet information hook that provides details about the connected wallet. Use this hook when you need to display wallet-specific information, show wallet branding, or implement wallet-specific features.

import { useWalletInfo } from '@reown/appkit/react'

export default Component(){
  const { walletInfo } = useWalletInfo()
}

Use Cases

  • Displaying wallet-specific information in your UI
  • Implementing wallet-specific features
  • Showing wallet icons or branding
  • Handling wallet-specific behaviors

useAppKitWallet

Using the wallet button hooks (Demo in our Lab), you can directly connect to the top 20 wallets, WalletConnect QR and also all the social logins. This hook allows to customize dApps, enabling users to connect their wallets effortlessly, all without the need to open the traditional modal. Execute this command to install the library for use it:

npm install @reown/appkit-wallet-button

Then you have to import the hook in your project:

import { useAppKitWallet } from "@reown/appkit-wallet-button/react";

And finally, you can use the hook in your project:

const { isReady, isPending, connect } = useAppKitWallet({
    onSuccess() {
      // ...
    },
    onError(error) {
      // ...
    }
  })

...

// Connect to a wallet
<Button onClick={() => connect("walletConnect")} />

Options for the connect parameter

TypeOptions
QR CodewalletConnect
Walletsmetamask, trust, coinbase, rainbow, coinbase, jupiter, solflare, coin98, magic-eden, backpack, frontier, xverse, okx, bitget, leather, binance, uniswap, safepal, bybit, phantom, ledger, timeless-x, safe, zerion, oneinch, crypto-com, imtoken, kraken, ronin, robinhood, exodus, argent and tokenpocket
Social loginsgoogle, github, apple, facebook, x, discord and farcaster

Use Cases

useAppKitWallet enables:

  1. Direct Wallet Integration

    • Direct connection to specific wallets (e.g., MetaMask, Coinbase)
    • Streamlined connection flow without modal
  2. Social Authentication

    • Social login options (Google, GitHub, etc.)
    • Email-based authentication
  3. Custom Wallet Selection

    • Branded wallet selection interface
    • Custom styling and filtering options
  4. Network-Specific Access

    • Chain-specific wallet options
    • Conditional wallet availability
  5. Enhanced UX

    • Loading states and error handling
    • Custom notifications
    • Responsive connection states

Ethereum/Solana Library

useAppKitAccount

Hook that returns the client’s information.

import { useAppKitAccount } from "@reown/appkit/react";

function Components() {
  const { address, caipAddress, isConnected } = useAppKitAccount();

  //...
}

useSignMessage

Hook for signing messages with connected account.

import { useSignMessage } from "wagmi";

function App() {
  const { signMessage } = useSignMessage();

  return (
    <button onClick={() => signMessage({ message: "hello world" })}>
      Sign message
    </button>
  );
}

Learn More