This project was bootstrapped with Create React App.
To run the project run npm install
and npm start
This react application implements a simple calculator. Calculator has following component hierarchy.
APP
- Screen (Input Box + Results Box)
- Input Components (dot,0-9)
- Command Components (clear, divide, multiply, minus, add, equals)
Our state will live in App.js
Use Cases:
- Enter Number
- Enter Command (When a command is hit, the input box clears but previous data is saved.)
- Enter Second Number -> calculate results
- Enter Second Command. (If the command is )
State: We will need state to store all the numbers and operations the user enters. They get calculated immediately after a new command is entered.
Approach
- Since state will probably need to be tweaked lets start there.
- I need a simple Number Component and a Command Component.