Understanding React component's lifecycle methods

Think about what a React component does. It describes what to render. We know that it uses the render() method for this. However, sometimes, having only the render() method is not enough because what if we want to do something before or after the component has rendered? What if we want to be able to decide whether a component's render() method should be called at all?

Looks like what we're describing is a process during which the React component is rendered. This process has various stages, for example, before render, render, after render, and so on. In React, this process is called the component's lifecycle. Each React component goes through this process. What we want is a way to hook into that ...

Get React.js Essentials now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.