Complete the code to import the useRoute function from Vue Router.
import { [1] } from 'vue-router';
The useRoute function is imported from vue-router to access the current route's information.
Complete the code to get the current route object inside the setup function.
const route = [1]();Calling useRoute() inside setup() returns the current route object.
Fix the error in accessing the route parameter named 'id'.
const userId = route.params.[1];route.params.paramsRoute parameters are accessed by their name, here 'id', inside route.params.
Fill both blanks to create a reactive computed property that returns the 'id' parameter as a number.
import { computed } from 'vue'; const route = useRoute(); const userId = computed(() => Number(route.params.[1])); console.log(userId.[2]);
The parameter name is 'id'. The computed property value is accessed with .value.
Fill all three blanks to create a Vue component that displays the route 'id' parameter reactively.
<script setup> import { [1] } from 'vue'; import { useRoute } from 'vue-router'; const route = useRoute(); const userId = [2](() => route.params.[3]); </script> <template> <p>User ID: {{ userId }}</p> </template>
We import computed from Vue, use it to create a reactive property, and access the 'id' parameter.