useBalance

Hook for getting a wallet's current balance of native or (optional) ERC20 token balance

Example

get the balance of the native token

import { useBalance } from "@thirdweb-dev/react";
function App() {
const { data, isLoading } = useBalance();
}

get the balance of any other token

import { useBalance } from "@thirdweb-dev/react";
function App() {
const { data, isLoading } = useBalance(tokenAddress);
}

Parameters

Returns

The hook's data property contains the token's balance in the value property as a BigNumber object.