Where to put QueryProvider for NextJS SSG pages?
I have NextJS app (with
app router).
I want to use react-query inside some components on the static generated pages, as well as in completely "use client" pages.
Is there a way to do that?1 Reply
metropolitan-bronze•3y ago
I think in general layouts are the way to go. See for example this implementation https://twitter.com/lukemorales/status/1585506850421854210
Luke Morales (@lukemorales)
@TkDodo @diegohaz Example to how setup React Query in the new router:
Separated file to declare client-side providers (not possible to instantiate QueryClient on a file that is not using the 'use client' indicative, since files will run on the server first and createContext is client-side only)

Twitter