O'Reilly logo

Developing a React Edge: The JavaScript Library for User Interfaces by The League of Extraordinary Developers

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

React components are simply state-machines. Their output represents the DOM for a given set of props and state. Throughout a component’s lifecycle, as it’s props or state change, its DOM representation might change too. As noted in the chapter on JSX, a component is just a Javascript function; 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 order of their appearance — first through instantiation, then through the components life and finally as the component is torn-down.

Lifecycle Methods

React has relatively few lifecycle methods, but they are very powerful. React ...

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