About React
React
It is a javascript library. We can use it for developing the user interface. It also known as React.js. It is maintained by facebook and a community of individual developers and companies. React can be used as a base in the development of SPA or mobile applications.
DOM
It represents the HTML elements that are present on a webpage. It is very useful for web developers to modify content through javascript, and all the code becomes much easier to work with.
JSX
JSX is javascript XML. It allows writing HTML to React. So we can easily write HTML in React.
const myelement = <h1>hello world</h1>;
We can write HTML without javascript code.
React Component
Basically, component means parts of something. Here react component is some similarities. On one single webpage, there are many parts like header, description, etc. They are called components. We can make one component and use it in many places but there must be the same in design but different in data.
State
React components are built-in state object. The state is where we can store property values that belong to the component. When the state changes, the component also changes.
Data mutation
Mutation means changeable. Array and objects are mutable. But numbers, strings, and booleans are immutable. For example, here Array.prototype.push allows adding an element in the array. So it changes the array.
const numbers = [1, 2];
numbers.push(3); // output [1,2,3]
Redux
Redux is a JavaScript library for managing application state. State decides what displayed on the user interface. We can use it to fetch data and store data, changing state, etc.
Props
It’s one kind of argument in javascript and attribute in HTML. It uses for pass data from one component to another component. It is immutable so we cannot modify the props from inside the component
React Lifecycle
It has three phases, they are mounting, updating, and unmounting. Mounting means add elements into the DOM. Second a component is updated whenever there is a change in the component’s state or props. The last phase in the lifecycle is when a component is removed from the DOM.