Lifecycle Methods

From codecademy.com, lifecycle-methods

In React, lifecycle methods are unique event listeners that listen for changes during certain points a component‘s lifecycle. A component’s lifecycle usually runs in this order:

  • Rendering/mounting a component to the DOM for the first time.
  • Updating an existing component.
  • Catching any errors associated with a component render-gone-wrong.
  • Unmounting a component and removing it from the DOM.

Lifecycle methods were originally exclusive to class components. But thanks to React hooks, functional components can also 'hook' into the component lifecycle.