Install ReactJS

React Installation

There are some prerequisites to set-up an environment for ReactJS. These are: NodeJS and NPM, React and React DOM, Webpack and Babel. To install ReactJS there are two ways: by using the npm command and by using the create-react-app command.

 

Using the create-react-app command:

The ‘create-react-app’ is a tool maintained by Facebook for beginners.

Step 1:

Install NodeJS and NPM.

Step 2:

Install React.

Command: npm install -g create-react-app

Step 3:

Create a new React project.

Command: create-react-app project_name

Step 4:

Combine the two steps in a single command.

Command: npx create-react-app project_name

Step 5:

To get started, open the src folder and make changes in your desired file.

Step 6:

Start the server after the completion of the installation process.

Command:

  • cd project_name
  • npm start

Step 7:

The port number will be displayed. Open the port in the browser.