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
I would also like to know what the best way is
same
Same.
same 🤷♂️
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.