Vue · Middle · Question 18 of 75

What does the 3.5 reactive props destructure allow?

const { size = "md", count } = defineProps<{ size?: string; count: number }>();
const double = computed(() => count * 2);

Explanation

The compiler rewrites count to props.count. To watch a destructured prop you still need a getter: watch(() => count, ...).

Further reading

Problem with a question

Vue · Middle · question 18

Test yourself

Take the Vue · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz