useFetch — simplified wrapper. useAsyncData — flexible.
useFetch:
useAsyncData:
1<script setup>2// useFetch3const { data } = await useFetch("/api/posts")45// useAsyncData6const { data } = await useAsyncData("posts", () => {7 return $fetch("/api/posts")8})910// useAsyncData with options11const { data } = await useAsyncData("posts", async () => {12 const [posts, users] = await Promise.all([13 $fetch("/api/posts"),14 $fetch("/api/users")15 ])16 return { posts, users }17})18</script>
When to use: