Problem Statement
List the main component lifecycle hooks and typical use cases.
Explanation
Creation: beforeCreate/created (or setup in Vue 3) for initializing data, starting requests. Mounting: beforeMount/mounted for DOM-dependent work. Updating: beforeUpdate/updated for reacting to re-renders. Unmounting: beforeUnmount/unmounted (Vue 3) or beforeDestroy/destroyed (Vue 2) for cleanup like removing listeners or canceling timers.
Practice Sets
This question appears in the following practice sets: