React Basics

·

1 min read

React is a flexible JavaScript library for building user interfaces which allows you to compose complex UIs from small and isolated pieces of code which are called “components”.

Components are independent and reusable. They can either be JavaScript functions or classes. Either way, they both return a piece of code that represents part of a web page.

Or you can say-

  • React is a JavaScript library for building user interfaces.

  • React is used to build single page applications.

  • React allows us to create reusable UI components.

Create React App

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:

C:\Users\md.arif>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 mdarif-test-app:

C:\Users\md.arif>npx create-react-app mdarif-test-app

Run the React Application

Run this command to move to the mdarif-test-app directory:

C:\Users\md.arif>cd mdarif-test-app

Run this command to execute the React application mdarif-test-app:

C:\Users\md.arif\mdarif-test-app>npm start

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