Lesson 4
Use React.js to view an account balance
React.js and useBalance() for live account data

In the following code sandbox, we start with a simple UI by creating a source wallet component and a destination account component. For demonstration purposes, we need control of the sender wallet, but let’s focus on what’s happening with the destination wallet.
We’ll use useBalance() to send a request to monitor the balance of the destination wallet. Remember, a request doesn’t require signing a transaction, so you can use this hook to check the balance of any account number you know, even if you don’t own the wallet yourself. Try sending XRP from the source wallet to the destination wallet. The useBalance() request will update the balance of the destination wallet once the XRP hits the account!