4. React Lifecycle Methods
Overview
In this chapter, we will implement various types of lifecycle methods in React. You will have a solid understanding over the entire React component lifecycle and how to use each of the lifecycle functions to their fullest. You will be able to implement lifecycle methods to set the state of the component when the component is initialized the first time. We will implement the mount lifecycle (constructor
, getDerivedStateFromProps
, render
, and componentDidMount
), the update lifecycle (getDerivedStateFromProps
, shouldComponentUpdate
, render
, getSnapshotBeforeUpdate
, and componentDidUpdate
) and the unmount
lifecycle (componentWillUnmount
) through several exercises and use them to create a messaging application.