Chapter 4. The component lifecycle

This chapter covers

  • Using the connectedCallback Web Components API method to listen when your component is added to the DOM
  • Knowing when and how to use the constructor method, especially because it occurs before the component has access to the DOM
  • Utilizing the disconnectedCallback Web Components API method to clean up after your component
  • The seldom-used adoptedCallback Web Components API method

4.1. The Web Components API

Up to now, we’ve explored a couple different methods from the Web Components API, but we really didn’t talk about the API as a whole. These methods are the basic building blocks for building everything from custom components to entire applications. So, it’s a good idea to take a look ...

Get Web Components in Action now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.