/    /  ReactJS- React Environment Setup

React Environment Setup

 

To run any React application(app), we must have NodeJS installed on your PC. So, the very important first step will be to install NodeJS.

 

Step 1: Install NodeJS. You may visit the official download link NodeJS of NodeJS to download and install the latest new version of NodeJS. Once we have set up NodeJS on your PC, the next thing we need to do is set up React Boilerplate.

 

Step 2: Setting up react environment for older node versions and latest new node versions. Follow anyone version based on your node version.

 

For Older node Versions which include Node < 8.10 and npm(Node Package Manager) < 5.6: Setting up React Boilerplate. We will install the boilerplate globally. Run the below command in your VScode terminal or command prompt to install the React.

npm install -g create-react-app

 

After running the above command on your terminal and then successfully installing the react boilerplate your terminal will show some output as shown in the below image:

 

Now after successfully installing the react the next step we will do is create our new React app. We can use the create-react-app command for creating a new app to React.

 

For the Latest node Versions which include Node >=8.10 and npm(Node Package Manager) >=5.6: For using the latest features of JavaScript(JS) which provides a good development experience, the machine should contain a version of Node >=8.10 and npm(Node Package Manager) >=5.6.

 

Run this below command to create a new React App:

npx create-react-app myreactapp

 

the above command will create the React app name myreactapp

 

You can run the project by typing the command cd myreactapp

cd myreactapp
npm start

 

output in the terminal:

 

you can view your app in the browser: