React Installation
Tutorials Web

How to install React?

ReactJs is one of the most widely used Javascript front-end libraries created by Facebook. It is used for mobile and web application development. React contains a collection of reusable code snippets used for building UI, called components.

ReactJS also allows you to create your own components and use them to create complex UIs.

Table of Contents

  1. How to install Node js in windows
  2. Verify the installation
  3. Create React Project
  4. Run React App
  5. Conclusion
Note: This guide focuses on React installation. 

1. how to install node js in windows

The first step you need to do, before you start coding in ReactJS, is to install Node JS. Node.js is a JavaScript runtime built on Chrome’s V8 JavaScript engine.

Node JS for windows
NodeJS installation
Click on Run
NodeJS installation
Click on Next
React - NodeJS installation
Accept the terms and click on Next
React - NodeJS installation
Select your directory and click on Next
React - NodeJS installation
Click Next
React - NodeJS installation
Skip this process – Click Next
React - NodeJS installatiom
Click Install and it will install NodeJS to your machine

2. Verify the installation

Now that we have installed NodeJS. Let’s make sure that it is installed correctly with npm ( node package manager).

Run the following command in the cmd to check the node version.

C:\Users\Username> node -v

If it displays some version number, then it means we have successfully installed nodeJS to our machine.

check Node Version
check node version

Similarly, we will check for the npm.

C:\Users\Username> npm -v  

It will display some version number if everything installs correctly.

check NPM version
check NPM version

3. Create React Project

Now that everything is working correctly, we will move on to creating our very own ReactJS project. To do so, you will need to go the directory, where you want to have your project. And run the following command:

C:\Users\Username> npx create-react-app myfirstreactapp
Note: Your react project name should be lowercase. 
creating a new react project
Creating a new React project

The above command will take sometime to create a new project with the name “myfirstreactapp.” Now, we can see the terminal as like below.

React Project installed correctly

4. Run React App

The above screen confirms successful creation of our project. Now, we need to start the server so that we can access the application on the browser.

Type the following command in the cmd:

cd myfirstreactapp 
// This is go into our react project. 

npm start

Doing so, will start our ReactJS project, which we can access on our local browser.

React project running successfully
React project running successfully
React project running in our browser
React project running in our local browser

We have successfully ran our own ReactJs project.

5. Conclusion

I hope that was easy for everyone to follow. As we have seen above, it’s really easy to install and run ReactJs on our system using NodeJS. Using create-react-app allows us to create ReactJs project immediately and we can start coding right away.

Related Articles:

1. Routing in React
2. Beginners guide to React and Bootstrap - Create Responsive Layout in React

One thought on “How to install React?

Leave a Reply

Your email address will not be published. Required fields are marked *