Master programming syntax, solve interactive challenges & run live code in Syntaxis Explore Arena →
menu_book Course Curriculum (Vue 3) expand_more
Vue 3 / Async & Routing Patterns

Lifecycle hooks

Learn Lifecycle hooks in Vue 3 with a dedicated explanation, a concept-specific example, a production caution, and a mastery check.

12 min read • Advanced
vue-3-040.vue
vue
<script setup>
import { onMounted,onUnmounted } from "vue"; const onResize=()=>console.log(innerWidth); onMounted(()=>addEventListener("resize",onResize)); onUnmounted(()=>removeEventListener("resize",onResize))
</script>
What to watch
Content source & attribution
Original Syntaxis Content · Original Syntaxis Content