Each component has several “lifecycle methods” that you can override to run code at particular times in the process. Methods prefixed with
will are called right before something happens, and methods prefixed with
did are called right after something happens.
These methods are called when an instance of a component is being created and inserted into the DOM:
An update can be caused by changes to props or state. These methods are called when a component is being re-rendered:
This method is called when a component is being removed from the DOM:
This method is called when there is an error during rendering, in a lifecycle method, or in the constructor of any child component.