O'Reilly logo

Developing a React Edge, 2nd Edition by Simon Højberg, Frankie Bagnardi, Richard Feldman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 3. Component lifecycle

Throughout a component’s lifecycle, as its props or state change, its DOM representation might change too. A component is a state machine; for a given input it will always return the same output. 

React provides lifecycle hooks for a component to respond to various moments—its creation, lifetime, and teardown. We’ll cover them here, in the order of their appearance—first through instantiation, and then through the components life, and finally as the component is torn-down.

Lifecycle methods

React components have a minimal lifecycle API, offering only what you need without being overwhelming. Let’s take a look at each method in the order they get called on your component.

Instantiation

The lifecycle methods that ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required