Complete the code to define a setup function that returns a reactive count variable.
<script setup> import { ref } from 'vue' const count = [1](0) </script>
The ref function creates a reactive reference to a value, which is perfect for simple reactive variables like count.
Complete the code to define a setup function that returns a method to increment count.
<script setup> import { ref } from 'vue' const count = ref(0) function increment() { count.value [1] 1 } </script>
To increase the count by 1, use the += operator on count.value.
Fix the error in the setup function to correctly return the count variable.
<script setup> import { ref } from 'vue' const count = ref(0) return [1] </script>
The setup function should return an object with properties to expose them to the template. Returning { count } exposes the reactive variable properly.
Fill both blanks to create a reactive object and expose its property in setup.
<script setup> import { [1] } from 'vue' const state = [2]({ count: 0 }) return { state } </script>
The reactive function creates a reactive object. We import and use it to make state reactive.
Fill all three blanks to create a computed property that doubles count.
<script setup> import { ref, [1] } from 'vue' const count = ref(1) const double = [2](() => count.value [3] 2) return { count, double } </script>
The computed function creates a reactive computed property. To double count, multiply count.value by 2 using *.