We're revisiting an oldie but goodie, only this time using React! Here are your tasks:
- Pass a
name
property to eachAccount
component, one for "Checking", the other for "Savings"
- Use the property you set in
App.js
and add it to the<h2>
- Add a
balance
property tostate
and set to 0 initially - When the
Deposit
button is clicked, you should add the amount entered in the text field to the balance - When the
Withdraw
button is clicked, you should deduct the amount entered in the text field to the balance
- You should not be able to withdraw more than the current balance
- If the current balance is 0, you should add a class of
zero
to the<div className="balance">
div
Add the accounting package to format the balance.
- Remember to set a
ref
on the text field for targeting - The amount entered in the text field will initially be a string, so you'll need to convert that to a number
- Don't forget to
bind
your click methods!
All content is licensed under a CCBYNCSA 4.0 license. All software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact [email protected].