Vue · Middle · Question 1 of 75

Why doesn't this watcher fire?

const state = reactive({ count: 0 });
watch(state.count, (n) => console.log(n));

Explanation

watch accepts a ref, a reactive object, a getter function or an array of these. Passing a property value gives it a number, which can't be tracked.

Further reading

Problem with a question

Vue · Middle · question 1

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