Vue3 Fundamentals · Modern Vue (3.5 / 3.6)

Vue 3.5 features

Vue 3.5 features

Vue 3.5 shipped three changes that remove small, everyday annoyances. You met each one earlier in the Course; this Lesson checks that you can tell them apart.

useTemplateRef replaces the old habit of declaring a ref in the script and matching it by name. You pass the template's ref name to the function and get a ref back:

<script setup>
import { useTemplateRef } from 'vue';

const input = useTemplateRef('input');
</script>

<template>
  <input ref="input" />
</template>

useId generates an id that is unique per component instance and stable across renders, so a label and its input never collide when the component is used twice.

Reactive props destructure lets you pull names straight out of defineProps and keep the link to the parent. The compiler rewrites each name into a getter, so const { count } = defineProps(['count']) updates when the parent passes a new value. Copying the props object first — const props = defineProps(...) then destructuring props — takes a snapshot and breaks that link.

All three are additive: older code still runs. They exist because the patterns they replace were noisy or easy to get wrong.

You are about to answer a short quiz on the Vue 3.5 features.

  1. `useTemplateRef` matches a template's `ref` attribute by the name you pass it.
  2. `useId` returns an id that is unique per component ___ and stable across renders.
  3. Destructuring names straight from `defineProps` keeps them reactive in Vue 3.5.
  4. To keep destructured props reactive, the compiler rewrites each name into a ___.
  5. Copying the props object first (`const props = defineProps(...)`) and then destructuring it keeps reactivity.