Next 13.4 - No QueryClient set
Hey, I just created a new next.app (13.4), added @tanstack/react-query. Created
_app.tsx file in app folder and put what's in the SSR section of RQ documentation.
Created page.tsx inside folder called 1 inside app folder and just used react query like I used to: const query = useQuery({ queryKey: ['todos'], queryFn: () => axios.get('/any/thing') }). And only thing I get is: Error: No QueryClient set, use QueryClientProvider to set one
6 Replies
ambitious-aqua•3y ago
can you create a repo or a codesandbox showing this please?
afraid-scarletOP•3y ago
Ok, so basically the problem was my dumb ass thought _app.tsx is still relevant in next 13. It's not. Maybe RQ team could split the documentation for next pre-13 and 13?
ambitious-aqua•3y ago
Yeah that's something @Ephem also mentioned already 🙂
manual-pink•3y ago
Yeah, the SSR docs have gradually grown into being pretty long and unstructured, sorry about that, definitely have plans to change it. 🙂
flat-fuchsia•3y ago
Just now getting around to upgrading a Next 12 to Next 13 app and this might have helped me. 😅
genetic-orange•3y ago
I am also facing this problem how can I fix it?
@adammo I found the solution by upgrading to beta
npm i @tanstack/react-query@beta