Complete the code to define a Vue component using the Composition API.
<script setup> import { ref } from 'vue' const count = ref(0) function increment() { count.value [1] 1 } </script> <template> <button @click="increment">Count: {{ count }}</button> </template>
We use += to add 1 to the current count value when the button is clicked.
Complete the code to bind a reactive property to the template.
<script setup> import { ref } from 'vue' const message = ref('Hello') </script> <template> <p>{{ [1] }}</p> </template>
message.value in the template causes errors.message() is incorrect for refs.In Vue templates, you use the ref variable name directly without .value.
Fix the error in the component setup by completing the import statement.
<script setup> import [1] from 'vue' const count = ref(0) </script>
reactive instead of ref causes errors here.computed or watch is not correct for this purpose.The ref function is needed to create reactive references like count.
Fill both blanks to create a reactive object and update its property.
<script setup> import { [1] } from 'vue' const state = [2]({ count: 0 }) function increment() { state.count++ } </script>
ref for objects requires different syntax.computed or watch is not correct here.Use reactive to create a reactive object like state.
Fill all three blanks to create a computed property that doubles a count.
<script setup> import { ref, [1] } from 'vue' const count = ref(1) const double = [2](() => count.value [3] 2) </script>
reactive instead of computed for derived values.+ instead of multiplication *.Use computed to create a reactive value based on count. Multiply by 2 with *.
