Through this article, you will learn how to install react with the common operating systems such as Windows, macOS, and Ubuntu. Just pay attention.
Table Of Contents
The React library is an open-source designed by Jordan Walke who was working at Facebook as a software engineer.
To install react on any operating system, you have to install node js and NPM package manager.
Install React On Windows, macOS, and Ubuntu
Anyway, to download Node.js you have to navigate to the official page. But make sure from the version number of the Node.js installer that is up to v14.0.0.
If you already have Node.js version on your machine and the version is lower than 14.0.0 you can upgrade to 14.0.0 by using the NVM which is node version manager.
Anyway, to install NodeJS using NVM you just have to run the following command on the Command Prompt.
nvm install 14.0.0
Or download it from the official page.
Note: the reason for ordering the installation of this version, because you will use the npx command, and this is not included in node versions before 14.0.0.
Here you have to make sure from which version of node.js you are using. And to do that, execute the following command.
And to get the version of NPM, use the below command
If the node.js version is prior of 14.0.0 , you can use the NVM command to switch between NodeJS versions. And to do that, run the following command.
nvm use 14.0.0
In the next paragraph, I am going to cover the React installation on macOS.
To install React on macOS, you have to navigate to the official page and download the installer for macOS. Follow this tutorial to learn more.
Also, you can install React on the Ubuntu operating system by the following instructions.
sudo apt-get install nodejs
Also, you need to use the same command to install NPM
sudo apt-get install npm
In the next section, you will learn how to create React application.
Create React App
To create React application, you have to run the following command.
npx create-react-app [APPLICATION-NAME]
Once it finishes the download, you will see instructions in the command line interface to start the web pack server.
Let’s explore the React folders and files to see the tasks of each one.
Explore React Folders and Files
The following image shows you the structures of the React app.
The React app is containing the following list
- The “.git” folder “src”efers to the version control system, to learn more read this article.
- The “node_modules” folder contains all libraries and React libraries. To learn more, read the node NPM tutorial.
- The “src” contains all row files that would be compiled such as ES6, SASS, and so many others.
In this tutorial, you understood how to install react on common operating systems such as macOS, Windows, and Ubuntu.
Also, you learned how to create React application and explored the application files and folders.
Thank you for reading.