Install React.js

Using npx - it’s a package runner tool that comes with npm 5.2+.

Note: To use npx you’ll need to have Node >= 8.10 and npm >= 5.6 on your machine.

npx create-react-app myFirstReactProject
cd myFirstReactProject
npm start

Note: myFirstReactProject is the name of your project, name it whatever you want.

Step-1: First, install - Create React App.
For Windows:
npm install -g create-react-app
For Linux and Mac:
sudo npm install -g create-react-app
Step-2: Now, create your project.
create-react-app myFirstReactProject
Step-3: Now, start the your app/project.
//Go to your project folder
cd myFirstReactProject

//Start your App
npm start
Some important files and folder created by Create React App
  • package.json - it's json config file which contains all modules and thier version details etc
  • package-lock.json - it's contains actual link of installed modules/dependencies in your react js application.
  • src - it's your main folder which contains all your code & components.
  • public - It's root folder of your react js application (index.html).
  • node_modules - It's Node Modules Library created by Node Package Manager (NPM).