What are the different phases of ReactJS component lifecycle?

Technology CommunityCategory: ReactWhat are the different phases of ReactJS component lifecycle?
VietMX Staff asked 3 years ago

There are four different phases of React component’s lifecycle: 1. Initialization: In this phase react component prepares setting up the initial state and default props. 2. Mounting: The react component is ready to mount in the browser DOM. This phase covers componentWillMount and componentDidMount lifecycle methods. 3. Updating: In this phase, the component get updated in two ways, sending the new props and updating the state. This phase covers shouldComponentUpdate, componentWillUpdate and componentDidUpdate lifecycle methods. 4. Unmounting: In this last phase, the component is not needed and get unmounted from the browser DOM. This phase include componentWillUnmount lifecycle method.