I was using vue router in my page /plates/:id to get the id according to the vue router docs for dynamic routes

<script setup>
import { ref, onMounted } from "vue";
 
const plate = ref({})
 
onMounted(async () => {
	const URL = `https://localhost:8443/api/plates/${$route.params.id}`
	const response = await fetch(URL)
	const data = await response.json()
	plate.value = data
 
})
</script>

But with the Vue Composition API, $route was undefined. The soluton was import {useRoute} from "vue-router";

<script setup>
import { ref, onMounted } from "vue";
import {useRoute} from "vue-router";
 
const route = useRoute()
const plate = ref({})
 
onMounted(async () => {
	const URL = `https://localhost:8443/api/plates/${route.params.id}`
	const response = await fetch(URL)
	const data = await response.json()
	
	plate.value = data
})
</script>