Learn React

Learn React

Author: AHMAD

React is a JavaScript library for building user interfaces.

React is used to build single page applications.

React allows us to create reusable UI component


Create React App

In order to learn and test React, you should set up a React Environment on your computer.

This tutorial uses the create-react-app.

The create-react-app is an officially supported way to create React applications.

If you have NPM and Node.js installed, you can create a React application by first installing the create-react-app.

Install create-react-app by running this command in your terminal:

npm install -g create-react-app

You are now ready to create your first React application!

Run this command to create a React application named myfirstreact:

npx create-react-app myfirstreact

The create-react-app will set up everything you need to run a React application.

Run the React Application

If you followed the two commands above, you are ready to run your first real React application!

Run this command to move to the myfirstreact directory:

cd myfirstreact

Run this command to execute the React application myfirstreact:

npm start

A new browser window will pop up with your newly created React App! If not, open your browser and type localhost:3000 in the address bar.

The result:


Log in to view more.