useAsyncData
Using useAsyncData
composable allows your app to fetch data more efficiently with status control (pending, error) and the refresh function option.
Check Nuxt 3 documentation for more details on useAsyncData
const { getItemById } = useDirectusItems();const { data: myCollection, pending, error, refresh,} = await useAsyncData("myCollection", () => getItemById({ collection: myCollection, id: id, params: params, }));
What do you think?