E1: NextJs Front End - Update

Front end updated with useEffect and useState for automatic balance updates.

I will outline the changes below, but you can find the full repo here - https://github.com/SimSimButDifferent/L3-L4-EthWalletFrontEnd

For the lesson 4 code, go the the L4 branch in the repo above.

Or check the deployment here - https://ethwalletapp.on.fleek.co/

EthWallet.tsx

updates:

  • Set userBalance as "Loading..." as default.

  • Added an if statement before setUserBalance in the handle functions, to also handle empty wallets.

  • Added useEffect to populate userBalance message when page launches. and to update depending on wether a wallet is connected or not and wether they have eth deposited.

  • Removed getUserBalance button, in favor of a auto-updated userBalance bar.

Last updated