Skip to content
Discussion options

You must be logged in to vote

The “Server Rendering & Hydration” guide comes first. It explains general principles, and one of them is: Don’t create a new QueryClient as a const outside of the component, because it will be shared between requests. It’s not about the browser, but about the server. With SSR, your code is isomorphic and runs in both environments. So create it in useState or an instance ref inside the component, as the guide shows: const [queryClient] = React.useState(...)

The Advanced SSR guide specifically focuses on nextJs and streaming in the app directory. Because of how nextJs creates a global suspense fallback (loading.tsx), whatever code we write could be below that suspense boundary, which means …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by patik
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants