TanStackT
TanStack2y ago
3 replies
developed-pink

React Query Prefetching and SSG

Hi guys, in my work, i'm trying to introduce React Query (currently Redux, but we want to migrate) and one of the things i'm looking for is to Prefetch Queries when html loads.

We are using Next.js App Router, and using SSG/ISR to build thousand of pages (Ecommerce Site), but we have some dynamic content like User, Basket or Wishlist, and that's where RQ enter.

For those dynamic content i want to do prefetch when HTML load, no JS load (Fetch then Render, instead of default Render then Fetch). So i'm currently a little bit confusing because i can't find this or explanation of this on the RQ docs, but i found it in the SWR docs.

I plan to test it but i wanna ask first. Anyone know about this? For looking at the code examples of the docs, it seems like RQ doesn't give any function to prefetch on HTML out of the box, i will need to insert HTML link tags manually?

Maybe i'm getting this wrong!!!
Was this page helpful?