How to install React?
ReactJS also allows you to create your own components and use them to create complex UIs.
Table of Contents
Note: This guide focuses on React installation.
1. how to install node js in windows
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.
Similarly, we will check for the npm.
C:\Users\Username> npm -v
It will display some version number if everything installs correctly.
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.
The above command will take sometime to create a new project with the name “myfirstreactapp.” Now, we can see the terminal as like below.
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.
We have successfully ran our own ReactJs project.
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?”