Vue · Middle · Question 1 of 75
Why doesn't this watcher fire?
const state = reactive({ count: 0 });
watch(state.count, (n) => console.log(n));- ✓Correct answer:
state.countis a plain number at call time; watch a getter instead:watch(() => state.count, ...) - 2
watchonly works with refs created byref() - 3Watchers fire only after
nextTickis called manually
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.