Lifecycle Hooks

A lifecycle hook is a callback method that triggers at a specific phase of a component instance’s lifecycle. With LWC, you can use the following lifecycle hooks.

In LWC API v61.0 and later, lifecycle callbacks fire using native browser APIs. Native lifecycle callbacks behave differently than callbacks in earlier versions of LWC, which rely on a synthetic polyfill. To learn more, check out Native Lifecycle Callbacks.

Lightning web components have a lifecycle managed by the framework. The framework creates components, inserts them into the DOM, renders them, and removes them from the DOM. It also monitors components for property changes.

This diagram shows the flow of the component lifecycle from creation through render.

Shows the lifecycle flow of a component instance from creation through renderedCallback.

This diagram shows what happens when a component instance is removed from the DOM.

Shows lifecycle for the disconnectedCallback.