How to setup react environment

By 1War Company - July 28, 2023
How to setup react environment

How to Setup React Environment?


React JS -

React is an open-source component-based front-end JavaScript library. It is used to create fast and interactive user interfaces for web and mobile applications. It is easy to create a dynamic application in React because it requires less coding and offer more functionality. It is used by big MNC and fresh new startups like 1WarCompanyAmazon,Netflix ,Airbnb,Spotify, for inspiration you can visit list of regaularly updated frontend projects Here...etc , , 

Features of React:

  1. Reusable Components: A single React app consists of many components each component have their own logic and code  but we can easily reuse components any number of time hence reducing the developers time and increasing the efficiency of work
  2. Debugging: React app can be easily debug using  “react developer tools”.It’s a browser extension that can be used for both chrome as well as Firefox.

Installation Reactjs on PC:

Step 1: Install Node.js installer for PC. Click on this link. Here install the LTS version (the one present on the left). Once downloaded open NodeJS without disturbing other settings, click on the Next button until it’s completely installed.




Step 2: Open command prompt  to check whether it is completely installed or not type the command

node -v
Node Version is v14.15.3

Node Version is v18.16.1

 

If the installation went well it will give you the version you have installe



Step 3: Now in the terminal run the below command: 

npm install -g create-react-app  
Installation will take few seconds

Installation will take few seconds 

It will globally install react app for you. To check everything  went well run the command  

create-react-app --version
version  4.0.3

version  5.0.1

 

If everything went well it will give you the installed version of react app



Step 4:Now Create a new folder where you want to make your react app using the below command: 

mkdir newfolder

Note: The newfolder in the above command is the name of the folder and can be anything.

Move inside the same folder using the below command:

cd newfolder (your folder name)



Step 5: Now inside this folder run the command

create-react-app reactfirst      <YOUR_APP_NAME>

creating a react app

It will take some time to install the required dependencies

NOTE: Due to npm naming restrictions, names can no longer contain capital letters, thus type your app’s name in lowercase.


 

Step 6: Now open the IDE of your choice for eg.  Visual studio code and open the folder where you have installed the react app newfolder (in the above example)  inside the folder you will see your app’s name reactapp (In our example). Use the terminal and move inside your app name folder.Use command  cd reactapp (your app name)



Step 7: To start your app run the below command :

npm start

Starting React server

Once you run the above command a new tab will open in your browser showing React logo as shown below :

Congratulation you have successfully installed the react-app and are ready to build awesome websites and app