Complete the code to create a Vue 3 component using the Composition API.
<script setup> import { ref } from 'vue' const count = [1](0) </script> <template> <button @click="count.value++">Count: {{ count }}</button> </template>
Vue 3 uses ref to create reactive primitive values like numbers.
Complete the code to conditionally render a message in Vue using the new control flow directive.
<template> <p @if="(isLoggedIn)">Welcome back!</p> <p @[1]>Please log in.</p> </template>
Vue 3.4+ uses @if and @else directives for control flow.
Fix the error in this Vue 3 component by completing the import statement correctly.
<script setup> import { [1] } from 'vue' const message = ref('Hello!') </script>
The ref function must be imported from 'vue' to create reactive references.
Fill both blanks to create a reactive object and watch its changes in Vue 3.
<script setup> import { [1], [2] } from 'vue' const state = [1]({ count: 0 }) watch(() => state.count, (newVal) => { console.log('Count changed:', newVal) }) </script>
reactive creates a reactive object, and watch observes changes.
Fill the blank to create a reactive counter with a method to increment it in Vue 3 Composition API.
<script setup> import { [1] } from 'vue' const count = [1](0) function increment() { count.value++ } </script> <template> <button @click="increment">Count: {{ count }}</button> </template>
ref creates reactive primitives. watch and computed are common imports but not used here.