Complete the code to create a reactive variable using Vue's Composition API.
<script setup> import { [1] } from 'vue' const count = [1](0) </script>
In Vue's Composition API, ref creates a reactive variable that holds a simple value like a number.
Complete the code to watch a reactive variable and log its new value.
<script setup> import { ref, [1] } from 'vue' const count = ref(0) [1](count, (newVal) => { console.log(newVal) }) </script>
The watch function lets you react to changes in reactive variables.
Fix the error in the code to correctly use a reactive object and update a property.
<script setup> import { reactive } from 'vue' const state = reactive({ count: 0 }) function increment() { state.[1]++ } </script>
The reactive object has a property named count, so you must update state.count.
Fill both blanks to create a computed property that doubles a reactive count.
<script setup> import { ref, [1] } from 'vue' const count = ref(5) const double = [1](() => count.value [2] 2) </script>
computed creates a reactive value based on others. Multiplying by * 2 doubles the count.
Fill all three blanks to create a reactive object, update a property, and watch the change.
<script setup> import { [1], watch } from 'vue' const state = [2]({ count: 0 }) watch(() => state.count, (newVal) => { console.log('Count changed to', newVal) }) state.[3] = 10 </script>
Use reactive to create the object, then update the count property to trigger the watcher.