Learn Vue JS course Learn Javascript and Vue JS Learn VueJS course Learn VueJS Tutorial

Nuxt.js 3 Fundamentals

Fetch data with useAsyncData thumbnail image

Get access to the most comprehensive Vue.js video library in the world. Over 300 video lessons including the newest Vue 3 features.

Fetch data with useAsyncData

In this lesson, we call the useAsyncData function to limit the request to OMDB only to the server side on initial page load.

Note: In the video I missed awaiting useAsyncData like this:

const { data } = await useAsyncData(() => {
  return $fetch(`http://www.omdbapi.com/?apikey=8e3f600b&i=${route.params.id}`);
});

Links