79454802

Date: 2025-02-20 14:20:05
Score: 1
Natty:
Report link

I also asked this question on the Nuxt-Subreddit r/Nuxt and the answer was this:

It’s only going to fetch it once. Either SSR (server side) or client-side. You need to store the data in some form of state so that as your navigate client-side, the data remains accessible as it’s persisted across page views.

That is unless the SDK you’re using does re-fetching and updating or something like you have in libraries like TanStack Query. Though I’ve seen that more used in the React world.

For Nuxt using the built in fetching and combining it with useState or Pinia is the recommended approach.

So basically, I had the wrong understanding of how the built-in fetch in Nuxt is working.

I will use Pinia.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Ludwig Loth