Can you get the queryClient without using a hook?
Can you get the queryClient without using a hook?
4 Replies
Yes if you don't need SSR, you create it during setup and it doesn't have to be created inside a component. It's just a variable you can export
Set up the React Query Integration | tRPC
How to use and setup tRPC in React
I forgot to add that I am using it with NextJS, I have a withTRPC wrapper in my App. Is there a way to extract the queryClient from there?
You will need the hook then
RQ has useQueryClient I believe
If you’re not using SSR you can probably get away with replacing the withTRPC with something lower level, but if you want SSR then it’s the hook for the above reasons