When the component's instance is created and inserted in DOM it’s called Mounting.
When a component is being re-rendered because of change in it's state or props or re-rendering of parent it’s called Updating.
When a component is being removed from DOM it’s called Unmounting.
<aside> 💡 One can check for any further updates on https://projects.wojtekmaj.pl/react-lifecycle-methods-diagram/.
</aside>
When there is an error during rendering, in a lifecycle method or constructor of any child component
static getDerivedStateFromError()
componentDidCatch()
Error boundaries are React components that catch JavaScript errors anywhere in their child component tree, log those errors, and display a fallback UI instead of the component tree that crashed.
It catch errors during rendering, in lifecycle methods, and in constructors of the whole tree below them.
Error boundaries work like a JavaScript catch{}
block, but for components.
componentDidCatch
and deriveStateFromError
yet.getDerivedStateFromError()
to render a fallback UI after an error has been thrown.componentDidCatch()
to log error information.Any error caused by a component somewhere deep in the tree, will still correctly propagate to the closest error boundary.
Error boundaries do not catch errors for: