A simple calculator using React.
View example on react-calculator-9002.surge.sh
$ cd react-calculator
$ npm install
$ npm start $ cd react-calculator
$ npm test For the same quality gates used in CI:
npm run lint
npm run test:ci
npm run buildApp owns the calculator state and routes key presses into the pure operation
engine. CalculatorKeyboard and CalculatorKey emit user input, while
CalculatorScreen renders the current total. The operation engine accepts and
returns a new { userTotal, calcVal, curVal, operand } state object; it does not
mutate caller-owned state. Invalid arithmetic and division by zero produce an
explicit Error display state instead of a browser alert.
The CI test command disables Jest's cache so every run exercises the checked out source. The production build is also compiled on every pull request.
Contributions are welcome!
- Fork it.
- Create your feature branch:
git checkout -b my-new-feature - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin my-new-feature - Submit a pull request :D
Or open up an issue.
Use the GitHub Issues page for reproducible bugs and feature proposals. See CONTRIBUTING.md before opening a pull request and SECURITY.md for private vulnerability reports.
Licensed under the MIT License.