Loading, please wait...

How to create the first application in the React?

Jun 29, 2020 React, ReactJS, 1172 Views
In this article, we will learn about to create the application in the React

How to create the first application in the React?

Before starting the procedure for creating the application, Why React? React is an open-source JavaScript library for creating dynamic UIs due to some facilities like it helps to break the app into small components so that working on one component may not affect other components and it is independent of the rest of the application and many more reasons.

There is an approach for creating React project:

  • Using create-React-app, which is the best and easiest way of building a single-page application.

As Prerequisite, that you may previously install nodejs and npm(node package manager) on the system and it should be the latest version, nodejs version is  12.18.1, and npm version is 6.14.4 or above and also install code editor i.e. Visual Studio Code/ Sublime/Atom/ Brackets.

To check the version, on the command prompt run node -v.

Installation of React

To create the application in the React, we have the react in the system. Installing the React using the “CRA tool” i.e. Create React App CLI tools expels every one of that complexities and makes React application basic in use.

To install it by using the following commands:

C:\Users\Gurjeet> npm install -g create-react-app  

You don’t have to change the location, be the default for the React installation where -g helps us for using this app from anywhere.

Create the React Project

Once React is installed, now we can create the new project in the react using the create-react-app command.

C:\Users\React> create-react-app reactproject

Where recatproject is the Project name. You can change the directory for the project for easiness with the new folder name where the project saves.

On the other hand, you may open the code editor and open the folder where you are working side by side with installing in command prompt.

React Project is completely installed in the system. Now, we need a server to start to access the application.

To run: C:\Users\React> npm start

At the default server, it will open on your localhost:3000 and Your REACT APPLICATION created.

Related Article