DEV Community

Cover image for Project 10 of 100: React Calculator
James Hubert
James Hubert

Posted on

Project 10 of 100: React Calculator

Hey! I'm on a mission to make 100 React.js projects in 100 days starting October 31, 2020 and ending February 7th, 2021. Please follow my dev.to profile or my twitter for updates and feel free to reach out if you have questions. Thanks for your support!

Link to today's deployed app: link
Link to the repo: github

The calculator is one of the classic introductory coding projects because to do it well involves so many concepts- from OOP to styling to basic algorithms.

I sort of failed at the functionality, but since I've done calculators before and understand the arithmetic portion I went for speed and focused on component building in React and styling for this one, which you'll notice if you try anything other than basic integer operations.

This blog post's calculator design jumped out at me so I took that screenshot for inspiration.

I used CSS Grid to quickly force the buttons into place and a controlled text component for the output, plus a separate component for the input buttons section.

This project is a real test of skill if you do it from scratch and I highly recommend it for anyone cutting their teeth in development. If you give it a try let me know how yours goes! Or if you have recommendations on how to quickly parse input data and perform calculations on it.

Top comments (3)

Collapse
 
urielbitton profile image
Uriel Bitton

Your calculator doesn't work.

  1. It doesn't return negative numbers
  2. Doing more than one operation at a time doesn't work

Try fixing these critical bugs maybe?
Cheers

Collapse
 
jameshubert_com profile image
James Hubert

Thanks Uriel. I mentioned in the post that it doesn’t work. The project was about rendering React components not the JavaScript operations.

Collapse
 
urielbitton profile image
Uriel Bitton

oh ok! sounds good then