Complete the code to create a reactive variable using Vue's Composition API.
import { ref } from 'vue'; const count = [1](0);
In Vue 3, ref is used to create a reactive primitive value.
Complete the code to correctly update a reactive object's property so Vue tracks the change.
import { reactive } from 'vue'; const state = reactive({ count: 0 }); state.[1] = 1;
You update reactive object properties by assigning directly to the property name.
Fix the error in the code to make Vue track the new property added to a reactive object.
import { reactive } from 'vue'; const state = reactive({}); // Adding new property state.[1] = 42;
Vue 3's reactive can track new properties added directly, so just use the property name.
Fill both blanks to create a reactive array and add a new item so Vue tracks the change.
import { [1] } from 'vue'; const items = [2]([]); items.value.push('apple');
Use ref to make an array reactive and then modify it directly.
Fill all three blanks to create a reactive object, add a new property, and watch it for changes.
import { reactive, watch, [1] } from 'vue'; const state = reactive({ count: 0 }); state.[2] = 5; watch(() => state.[3], (newVal) => console.log(newVal));
Use ref in import, add property total, and watch total for changes.