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.