In the beginning, we mentioned a few other lifecycle methods apart from componentDidMount() and componentWillMount(). React also recognizes these if they have been implemented within a class component.

To understand these different lifecycle methods better, let’s create an example component in which we include the lifecycle methods in debug messages. This will help us to see them in the browser console. To be more precise, the example actually consists of two components:

Component lifecycle

Get hands-on with 1200+ tech skills courses.