> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dynamic.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Get balance for all wallets

> In this example, we will get the balance for each connected wallet.

> [card] Recommended: JavaScript SDK with React Hooks
>
> For new React apps, we recommend the JavaScript SDK with React Hooks (`@dynamic-labs-sdk/react-hooks`) instead of the legacy React SDK documented here. The JS SDK comes with many benefits such as a much smaller bundle size and other optimizations. Use the [React quickstart (JavaScript SDK)](https://docs.dynamic.xyz/docs/javascript/reference/react-quickstart.md) to get started.

For each wallet, we will get the provider with [useRpcProviders](https://docs.dynamic.xyz/docs/react/reference/hooks/userpcproviders.md), to fetch the
balance by calling the `getBalance` with the wallet address.

```JavaScript theme={"system"}
import { useUserWallets } from '@dynamic-labs/sdk-react-core';

import { useRpcProviders } from '@dynamic-labs/sdk-react-core'
import { evmProvidersSelector } from '@dynamic-labs/ethereum-core'

const App = () => {
  const userWallets = useUserWallets();
  const { defaultProvider } = useRpcProviders(evmProvidersSelector)

  useEffect(() => {
    userWallets.forEach(async (wallet) => {
      if (!wallet) return;

      // Get the EVM Mainnet provider
     const provider = defaultProvider?.provider;

      if (!provider) return;

      // Fetch the wallet balance
      const balance = await provider.getBalance({ address: wallet.address });

      console.log('balance', balance.toString());
    });
  }, [userWallets, defaultProvider]);

  ...
}

```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.