Install Reactjs - Step by Step Installation Guide (GitHub)

Reactjs can be installed on your local machine by using following ways:

  1. npx
  2. npm
  3. yarn
  4. create-react-app
1. Using NPX - it’s a package runner tool that comes with npm 5.2+
npx create-react-app my-first-project
2. Using NPM - it is available in npm 6+
npm init react-app my-first-project
3. Using Yarn - it is available in Yarn 0.25+
yarn create react-app my-first-project

After installing reactjs using any of the above method

Go to the your project folder and run your react app

    cd my-first-project
    npm start

Note: my-first-project is the name of your react project, you can change it as per your interest/requirement.

4. Using create-react-app

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 my-first-project

Step-3: Now, start the your app/project.

//Go to your project folder
cd my-first-project

//Start your App
npm start
Important Points:
  • package.json - it's a json config file which contains the metadata details (e.g.- package name and thier versions, dependencies, devdependencies, etc.) of your react app.
  • 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).