[Vuejs]-How to handle the async data in vue3

0👍

You defined userData as a ref (see https://vuejs.org/api/reactivity-core.html#ref)

const userData = ref([])

When you want to access the value of userData inside your code block, you need to use the property .value to points to the inner value.
If access is in the template tag, don’t use the .value property.

So the corrected line would be :

testName.value = userData.value.name

Leave a comment