Rule
Rule12mo ago

tRPC with with react-query prefetching in Next.js app directory.

Hi. What is currently the best way to do prefetching in Next.js app directory when using @tanstack/react-query and Next.js app directories?
5 Replies
wleistra
wleistra12mo ago
I would also like to know what the best way is
noahsolomon
noahsolomon12mo ago
same
gui
gui12mo ago
Same.
markit
markit12mo ago
same 🤷‍♂️
TkDodo 🔮
TkDodo 🔮12mo ago
We have an excellent new guide in the v5 docs: https://tanstack.com/query/v5/docs/react/guides/ssr
Server Rendering & Hydration | TanStack Query Docs
In this guide you'll learn how to use React Query with server rendering. See the guide on Prefetching & Router Integration for some background. You might also want to check out the Performance & Request Waterfalls guide before that.