const element = <h1>Hello, world!</h1>;
React’s has different lifecycle methods. A component’s lifecycle is classified into 4 parts:
In this phase, the component is going to start by setting up the state and the props. This is generally done inside the constructor method.
Mounting is the phase-in React component mounts on the DOM section. This phase comes when the initialization phase is completed. In this phase, react component renders the first time. The methods that are available in this phase are:
The 3 no phase through that react component passes. The component has created, when the mounting phase is done. This is the phase where components state change and re-rendering. There are 3 methods on this phase:
Unmounting is the last phase in the component’s lifecycle. In this phase, the component gets unmounted from the DOM. In this phase method is: