So far, you have a list of accounts in the sidebar and can see the balance of each account by selecting them. Now, it's time to implement transfers between accounts.
First of all, we need at least three parameters to perform a successful transaction:
- Source account
- Target account
- Amount to transfer
We are going to use React Hooks since this is the most efficient and fastest way to get started. You need at least three pairs of hooks. Let's get started:
- Introduce a pair of React hooks for each attribute:
const [account, setAccount] = useState(null);const [targetAccount, setTargetAccount] = useState(null);const [transferAmount, setTransferAmount] = useState(0);
We already handle account selection via ...