Lifecycle Hooks

Explore the various lifecycle hooks and when we would use them.

When a new component instance is created, it goes through various stages. At each stage, it can run a function to perform a task, and these are called lifecycle hooks. The lifecycle begins before a component has been created and ends when it is unmounted, with various stages in between.

Overview

Lifecycle hooks can be used with both the Options API and Composition API. Here is a comparison of the names of the hooks in both:

Get hands-on with 1200+ tech skills courses.