Component life cycle methods
The React component has many life cycle methods that you can override. These methods are executed at certain phases of the component's life cycle. The names of the life cycle methods are logical and you can almost guess when they are going to be executed—the life cycle methods that have a will prefix are executed before an action is performed, and the methods with a did prefix are executed right after an action is performed.
Mounting is one phase of the component life cycle. It is the moment when the component is created and inserted into the DOM. Two life cycle methods that we have already covered are executed when the component mounts constructor() and render().
A useful method in the mounting phase is componentDidMount() ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access