Vue · Senior · Question 57 of 75
Why does Nuxt warn against calling $fetch directly in <script setup> for page data?
- ✓Correct answer: It runs on the server and again in the browser during hydration;
useFetch/useAsyncDatatransfer the result in the payload - 2
$fetchdoesn't work on the server - 3
$fetchdoesn't support JSON
Explanation
Double fetching wastes requests and can cause hydration mismatches. $fetch is fine in event handlers.