Réponse

componentWillMount
render
componentDidMount

Colonne
Explication

There are three mounting lifecycle methods. When a component renders for the first time, componentWillMount gets called right before render. If you need to do something only the first time that a component renders, then it’s probably a job for a mounting lifecycle method! Just before the render function > componentWillMount() {}

When a component renders for the first time, componentDidMount gets called right after the HTML from render has finished loading. You want something to happen right after the very first rendering… that’s exactly what componentDidMount is for!

In between componentWillMount and render, use componentDidMount method:
componentDidMount() {}

Question

When a component mounts, it automatically calls three methods ?

Thématique