NuxtN
Nuxt2y ago
31 replies
JV

moving from Nuxt2 useFetch to Nuxt3 useAsyncData - how would you refactor this example?

Hello, as a title says, how would you refactor this example to keep SSR working exactly 1:1?

Nuxt 2
  const homePage = ref<HomePage | null>(null)
  const homePageLoaded = ref<boolean>(false)

  useFetch(async () => {
    homePage.value = await loadHomePage()
    homePageLoaded.value = true
  })
Was this page helpful?