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
- How to install Node js in windows
- Verify the installation
- Create React Project
- Run React App
- 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.
Accept the terms and click on Next
Select your directory and click on Next
Skip this process – Click Next
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.
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.
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
Doing so, will start our ReactJS project, which we can access on our local browser.
React project running successfully
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:
Related Article:
Beginners guide to React and Bootstrap - Create Responsive Layout in React
Top comments (2)
Just a Note: You don't need to install NodeJS to have ReactJS project. You can use script tag, the same as JSX you can use babel as script tag included in HTML. This is something that you can make to quickly start playing with React.
Yes, I have tried it once. :)