Complete the code to import the Composition API function for reactive state.
import { [1] } from 'vue'; const count = [1](0);
The ref function creates a reactive reference to a value, which is the basic way to hold reactive state in the Composition API.
Complete the code to define a reactive object using the Composition API.
import { [1] } from 'vue'; const state = [1]({ count: 0 });
The reactive function creates a reactive object, which is useful for grouping multiple reactive properties together.
Fix the error in the code by choosing the correct way to access a reactive ref's value.
import { ref } from 'vue'; const count = ref(0); console.log(count[1]);
To get the actual value inside a ref, you must use the .value property.
Fill both blanks to create a computed property that doubles a reactive count.
import { ref, [1] } from 'vue'; const count = ref(1); const double = [2](() => count.value * 2);
The computed function creates a reactive value that updates automatically based on other reactive values.
Fill all three blanks to create a reactive object, a computed property, and a watcher that logs changes.
import { [1], [2], [3] } from 'vue'; const state = [1]({ count: 0 }); const double = [2](() => state.count * 2); [3](() => console.log('Count changed:', state.count));
reactive creates a reactive object, computed creates a derived reactive value, and watch runs code when reactive data changes.