Complete the code to create a reactive variable in Vue.
const count = [1](0);
In Vue, ref is used to create a reactive primitive value like a number.
Complete the code to create a reactive object in Vue.
const state = [1]({ count: 0 });
reactive is used to make an object reactive in Vue.
Fix the error in the code to correctly watch a reactive variable.
watch([1], (newVal) => { console.log(newVal); });count.value instead of count when passing to watch.To watch a ref, pass the ref directly to watch. The callback receives the unwrapped value automatically.
Fill both blanks to create a computed property that doubles a reactive count.
const doubleCount = [1](() => [2] * 2);
computed creates a reactive computed property, and you must use count.value to access the ref's value.
Fill all three blanks to create a reactive object with a nested reactive property and watch it.
const state = [1]({ nested: [2]({ value: 1 }) }); watch(() => state.nested.[3], (val) => console.log(val));
Use reactive for the outer object, ref for the nested reactive property, and watch the .value inside the nested ref.