How to install React?

mshahryiar

Muhammad Shahryiar

Posted on August 4, 2022

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
Enter fullscreen mode Exit fullscreen mode
  1. How to install Node js in windows
  2. Verify the installation
  3. Create React Project
  4. Run React App
  5. Conclusion

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.

Image description
Node JS for windows

Image description
Click on Run

Image description
Click Next

Image description
Accept the terms and click on Next

Image description
Select your directory and click on Next

Image description
Click Next

Image description
Skip this process – Click Next

Image description
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
Enter fullscreen mode Exit fullscreen mode

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

Image description
check node version

C:\Users\Username> npm -v  
Enter fullscreen mode Exit fullscreen mode

It will display some version number if everything installs correctly.

Image description
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
Enter fullscreen mode Exit fullscreen mode

Note: Your react project name should be lowercase.

Image description
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.

Image description
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:

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


npm start
Enter fullscreen mode Exit fullscreen mode

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

Image description
React project running successfully

Image description
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.

For more articles, visit:

Tech With Sherry

Related Article:

Beginners guide to React and Bootstrap - Create Responsive Layout in React

💖 💪 🙅 🚩
mshahryiar
Muhammad Shahryiar

Posted on August 4, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related