DEV Community

Discussion on: React Beginner Question Thread ⚛

Collapse
 
dan_abramov profile image
Dan Abramov • Edited

When something is rendered for the first time, the component "mounts". This is when componentDidMount fires.

When something of the same type is rendered in the same place again, the existing component "updates". This is when componentDidUpdate fires.

Finally, when component is being removed (because the parent no longer renders it), componentWillUnmount fires.

There are a few other lifecycles but they're more exotic and much less common. We're also probably going to change some of them so I recommend not spending too much time on learning those.

Collapse
 
daniel15 profile image
Daniel Lo Nigro

Not sure if it's still up-to-date, but I used to refer to this diagram: d.sb/reactlifecycle