Lifecycle hooks

Lifecycle hooks are functions called by Vue at specific moments in a component's life: onMounted after insertion into the DOM, onUpdated after an update, onUnmounted before destruction. They are used to launch requests or to clean up listeners and timers.

Example

onMounted(() => charger())
onUnmounted(() => clearInterval(minuteur))

Related concepts

The whole glossary