Complete the code to create a reactive reference to the 'count' property in the state object.
import { reactive, [1] } from 'vue'; const state = reactive({ count: 0 }); const countRef = [1](state, 'count');
Use toRef to create a reactive reference to a single property inside a reactive object.
Complete the code to destructure all properties from the reactive state object using the correct Vue function.
import { reactive, [1] } from 'vue'; const state = reactive({ name: 'Alice', age: 30 }); const { name, age } = [1](state);
toRefs converts all properties of a reactive object into refs, allowing destructuring while keeping reactivity.
Fix the error in the code by choosing the correct function to keep reactivity when destructuring.
import { reactive, [1] } from 'vue'; const state = reactive({ score: 100 }); const { score } = state; // This breaks reactivity const reactiveScore = [1](state).score;
Using toRefs on the reactive object allows destructuring while preserving reactivity.
Fill both blanks to create a reactive reference to 'title' and destructure 'author' and 'year' from the reactive book object.
import { reactive, [1], [2] } from 'vue'; const book = reactive({ title: 'Vue Guide', author: 'Evan', year: 2024 }); const titleRef = [1](book, 'title'); const { author, year } = [2](book);
Use toRef for a single property and toRefs to destructure multiple properties reactively.
Fill all three blanks to create reactive references for 'firstName', destructure 'lastName', and create a reactive reference for 'age' from the user object.
import { reactive, [1], [2], [3] } from 'vue'; const user = reactive({ firstName: 'John', lastName: 'Doe', age: 25 }); const firstNameRef = [1](user, 'firstName'); const { lastName } = [2](user); const ageRef = [3](user, 'age');
Use toRef for single properties and toRefs for destructuring multiple properties reactively.