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.

This course was originally built with Nuxt 3, but it's no longer being maintained. You can still follow the lessons, but make sure to use the exact dependency versions listed in the course repository to avoid breaking changes.

If you’re looking for the most up-to-date and fully supported version, we recommend Mastering Nuxt: Full Stack Unleashed , which uses Nuxt 4 and actively being maintained.