DejaVue

Data Fetching in Vue and Nuxt


Listen Later

Data fetching is a crucial part of any web application. In this episode of DejaVue, we discuss the different ways to fetch data in Vue.js and Nuxt.js, and how to cache it. 

We also talk about the experimental Suspense feature in Vue.js and how it can be used to improve the user experience, as well as how to handle third-party scripts in your application.

In addition, Nuxt's data fetching options are discussed, including the $fetch method, useFetch, useAsyncData and the useNuxtData composable. Finally, we cover server-side caching in Nuxt.js, including route rules, defineCachedEventHandler, and defineCachedFunction.

Enjoy the episode! 

Chapters

  • (00:00) - Welcome to DejaVue
  • (00:50) - Which topics should be covered next?
  • (01:56) - This episodes topic - Data Fetching
  • (04:13) - Two ways of client-side caching
  • (06:17) - What is Data Fetching actually - and which library to use?
  • (08:19) - Suspense in Vue.js
  • (14:03) - Third Party Scripts
  • (17:38) - Data fetching basics in Nuxt.js
  • (20:28) - $fetch vs useFetch
  • (23:27) - $fetch request deduplication on the server
  • (24:43) - Caching in Nuxt.js
  • (28:18) - routeRules of server-side caching
  • (29:38) - defineCachedEventHandler / defineCachedFunction
  • (32:19) - Unstorage for storing the cached files
  • (35:41) - useNuxtData
  • (40:26) - Why does Nuxt offer more data fetching options?
  • (45:32) - Wrapping up

  • Links and Resources

    • LAST CHANCE 15% discount for the VueConf Toronto* with code DEJAVUE


    • ofetch
    • ky
    • Suspense in Vue
    • Data Loaders
    • DejaVue #E030 - Pinia and Data Loaders (with Eduardo San Martin Morote)
    • nuxt-workers
    • Partytown
    • squoosh.app
    • DejaVue #E001 - The Need for SSR
    • You are using useFetch wrong
    • DejaVue #E003 - Nitro: The Next Generation Server Toolkit
    • Caching in Nitro
    • Client side caching with getCachedData
    • Composable Caching Utils issue
    • Route Rules in Nuxt
    • DejaVue #E002 - Building a Nuxt.js SaaS in less than a week (with Harlan Wilton)


    Your Hosts

    Alexander Lichter

    • BlueSky
    • Twitter
    • YouTube
    • Twitch
    • Website


    Michael Thiessen

    • Twitter
    • YouTube
    • Website


    Links marked with * are affiliate links. We get a small commission when you register for the service through our link. This helps us to keep the podcast running. We only include affiliate links for services mentioned in the episode or that we use ourselves.

    ...more
    View all episodesView all episodes
    Download on the App Store

    DejaVueBy Alexander Lichter & Michael Thiessen


    More shows like DejaVue

    View all
    Hanselminutes with Scott Hanselman by Scott Hanselman

    Hanselminutes with Scott Hanselman

    377 Listeners

    .NET Rocks! by Carl Franklin and Richard Campbell

    .NET Rocks!

    244 Listeners

    The Changelog: Software Development, Open Source by Changelog Media

    The Changelog: Software Development, Open Source

    284 Listeners

    Startups For the Rest of Us by Rob Walling

    Startups For the Rest of Us

    696 Listeners

    The Vergecast by The Verge

    The Vergecast

    3,672 Listeners

    Accidental Tech Podcast by Marco Arment, Casey Liss, John Siracusa

    Accidental Tech Podcast

    2,092 Listeners

    Thoughtworks Technology Podcast by Thoughtworks

    Thoughtworks Technology Podcast

    40 Listeners

    Talk Python To Me by Michael Kennedy

    Talk Python To Me

    590 Listeners

    Software Engineering Daily by Software Engineering Daily

    Software Engineering Daily

    621 Listeners

    Soft Skills Engineering by Jamison Dance and Dave Smith

    Soft Skills Engineering

    269 Listeners

    Syntax - Tasty Web Development Treats by Wes Bos & Scott Tolinski - Full Stack JavaScript Web Developers

    Syntax - Tasty Web Development Treats

    987 Listeners

    Darknet Diaries by Jack Rhysider

    Darknet Diaries

    7,879 Listeners

    The Stack Overflow Podcast by The Stack Overflow Podcast

    The Stack Overflow Podcast

    62 Listeners

    The Real Python Podcast by Real Python

    The Real Python Podcast

    139 Listeners

    Chatabix by Keep It Light Media / Big Oval Plate

    Chatabix

    200 Listeners