useDApp: useEtherBalance returns undefined

Following the basic example:

export function App() {
  const { activateBrowserWallet, deactivate, account } = useEthers()
  const userBalance = useEtherBalance(account)


  return (
    <div>
      {!account && <button onClick={activateBrowserWallet}> Connect </button>}
      {account && <button onClick={deactivate}> Disconnect </button>}

      {account && <p>Account: {account}</p>}
      {userBalance && <p>Ether balance: {formatEther(userBalance)} ETH </p>}
    </div>
  )
}

I can get my account address, but I get undefined for userBalance, no matter what I do it is always undefined.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 17 (6 by maintainers)

Most upvoted comments

Hey @Vanclief, I have literally one commit here, and it only affects the docs. I’m not the best person to ask about this 😄

I’d use wagmi as suggested for tempo use, but definitely would love some one have useDapp checked! Thx in advance for any help.