Join our community

Get access to the complete guide to developing and deploying fast, production-ready Nuxt apps.

5-5 Basic Data Fetching

In this lesson, we cover all the basics of data fetching in Nuxt 3.

First, we build a useLesson composable that fetches data from our brand new endpoint. Through this, we’ll see how to useFetch works to enable us to fetch from any URL.

Next, we dig into how useFetch works, and discover that it’s a wrapper around useAsyncData and $fetch. The useAsyncData composable is the real work horse here, letting us easily work with any asynchronous data while managing SSR and deduplication for us.

We learn a bit more about $fetch, and how it’s an isomorphic function that runs on both the client and the server. However, when run on the server, $fetch will directly call the endpoint method, skipping all of the HTTP request overhead.