re: React Beginner Question Thread ⚛ VIEW POST

VIEW FULL DISCUSSION
 
 

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.

 

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

code of conduct - report abuse