Unmounting Hooks
Learn and practice the two Vue lifecycle hooks related to object destruction—beforeUnmount and unmounted.
We'll cover the following...
Let’s look at the last two regular lifecycle hooks—beforeUnmount
and unmounted
. These two get called right before and right after removing a component respectively. A component is considered destroyed once everything related to the component is gone. This includes reactivity, templates, and child components. Let’s first see how we can add them.
Note: In Vue 2,
beforeUnmount
andunmounted
used to be namedbeforeDestroy
...