Passing QueryClient but still getting `No QueryClient set, use QueryClientProvider to set one
7 Replies
typical-coral•3y ago
Could you give us some more context or info about the problem you are facing?
1. Are you using Tanstack Router in a SPA or in server-side rendering?
2. Is the query client stable? (Are you doing
new QueryClient() inside a component? or outside of a component?)
3. If it is a SPA, have you made sure to render the RouterProvider after the QueryClientProvider?ratty-blushOP•3y ago
@Sean Cassiere posted in the wrong channel
typical-coral•3y ago
Cool stuff!
ratty-blushOP•3y ago
@Sean Cassiere im not using tanstack router, im using react router 6 and the problem is on the login page its working fine but as soon as i move to /dashboard page it breaks and throws an error
should i ask for help in query channel? and delete the post here
1. Not using tanstack router and using client side rendering
2. Outside component
3. dont know how to confirm that but it seems to work fine on login router but crashed on dashboard
typical-coral•3y ago
You'll want to confirm this stuff in the #react-query-questions channel?
Basically you want the setup to look something like this.
app.tsx
Here's the example repo with react-router in the Tanstack Query docs - https://github.com/TanStack/query/blob/beta/examples/react/react-router/src/index.jsx
GitHub
query/examples/react/react-router/src/index.jsx at beta · TanStack/...
🤖 Powerful asynchronous state management, server-state utilities and data fetching for the web. TS/JS, React Query, Solid Query, Svelte Query and Vue Query. - TanStack/query
typical-coral•3y ago
If this doesn't fix it as Dom said, you may want to get a codesandbox or stacklitz sample running so he could look at it.
https://discord.com/channels/719702312431386674/1158692457857417267
ratty-blushOP•3y ago
thank you, fixed it