Basic information about React.JS
Today I will go and discuss 10 basic information of React.JS. I think you are excited. So, Let’s start without Wasting Time.
01. What is React?
The React.JS is an open-source JavaScript library that can be used to create a single page application interface. Data can be changed without loading any page in a single-page application. The main purpose of React is to be fast, scalable, and simple.
02. How to Create React App?
First of all, Open the code editor and enter the command line “npm create-react-app appName”. Once the app is created, you have to enter the “npm start” command. Then the react app will be started.
03. Render() Method:
The render() method is an important method of the class component. The render() method works by displaying the specific HTML code inside the specific HTML element. The render() method takes two arguments, HTML code and HTML elements.
import React from 'react';
import ReactDOM from 'react-dom';
ReactDOM.render(
<p>Hello</p>,
document.getElementById('root')
);
04. Constructor() function:
A Constructor is a function that creates an example of a class commonly known as an object. A constructor is called when something is announced using a new keyword in JavaScript. The constructor's purpose is to create an object and determine its value if there is an object property.
05. setState() Method:
The useState() method is hooked that allows the functional elements to be placed in a state variable. This function passes the initial state and sets the value from somewhere else to update the value of the previous value.
06. What is JSX?
JSX is the XML of JavaScript. Writing HTML code in React makes it much easier for JSX.
07. What is JavaScript Framework?
The JavaScript Framework is an essential component of modern front-end development. Through which web applications are created. Provides tested and tools for creating interactive web applications.
08. Props:
Props is a special keyword for React. The Props keyword is used to pass data from one element to another element.
09. Virtual-DOM:
The virtual DOM (VDOM) is a programming concept where an ideal, or “virtual”, representation of a UI is kept in memory and synced with the “real” DOM by a library such as ReactDOM. This process is called reconciliation. They may also be considered a part of “virtual DOM” implementation in React.
10. Lifecycle:
Each component in React has a lifecycle that you can monitor and manipulate during its three main phases. There are three phases: Mounting, Updating, and Unmounting.