What is `useFetch` in Nuxt.js?

Answer

useFetch is a convenience wrapper around useAsyncData and Nuxt's $fetch utility that combines both in a single composable specifically designed for HTTP requests. It automatically generates the cache key from the URL and options, making it simpler than useAsyncData for direct API calls. Usage: const { data, pending, error } = await useFetch('/api/users'). It supports options like method, body, headers, query, lazy, and watch. The lazy option defers the fetch until after navigation, useful for non-critical data.