Events & State Changes

Events & State Changes

The useWallet hook provides reactive state that updates automatically when the user changes their network, switches accounts, or disconnects. There is no need to register manual event listeners.

import { useWallet } from "@aptos-labs/wallet-adapter-react";
 
function WalletStatus() {
  const { connected, network, account } = useWallet();
 
  if (!connected) {
    return <p>Not connected</p>;
  }
 
  return (
    <div>
      <p>Network: {network?.name}</p>
      <p>Address: {account?.address}</p>
    </div>
  );
}

Available State

PropertyTypeDescription
connectedbooleanWhether a wallet is currently connected
networkNetworkInfo | nullCurrent network (Mainnet, Testnet, Devnet, etc.)
accountAccountInfo | nullCurrent account address and public key
walletWalletInfo | nullInfo about the connected wallet

All of these values re-render your component automatically when the underlying state changes — for example, when the user switches accounts or changes networks in Petra.

Because the Wallet Adapter is built on React context, any component inside your AptosWalletAdapterProvider can access the current wallet state via useWallet().