How to Dynamically Build a Calculator in React

A calculator is among the top 5 projects a beginner in web development should make to test his programming skills. It is used to test the basics of any programming language a web developer should have for moving forward.

In this blog, we will make a simple calculator with all its functionalities but with the help of React Hooks and simple js functions.


  1. Getting Started
  2. Creating our React app
  3. Working on the UI part of the app
  4. Creating buttons dynamically
  5. Adding functionality with hooks
  6. Wrapping Up

Let’s begin

Getting Started

Making a calculator in React tests some basic skills like hooks and creating and using dynamic data to get the value.

We will be using Bootstrap as CDN for our app for styling purposes, but you can also go with other css frameworks or even use Vanilla CSS.

We hope that after this tutorial, you will be well versed with some basic concepts of React and Hooks and mostly use dynamic data to reduce the number of lines of codes.

Creating our React App

It’s easy to create a React App, go to your working directory in any of your preferred IDE’s and enter the following command in the terminal

If you are unsure how to properly set up a create-react-app project you can refer to the official guide here at create-react-app-dev.‌‌

npx create-react-app calculator-in-react

After the setup, run npm start in the same terminal to start the localhost:3000 where our React will be hosted and we can see all our changes there.

To read the full article and learn how to use data dynamically visit the official site —



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ateev Duggal

I am a front-end developer from India with over one year of experience in freelancing with skills like Git, HTML5, CSS3, Bootstrap 4&5, and React.