79083059

Date: 2024-10-13 12:02:41
Score: 0.5
Natty:
Report link

The other answers are correct, in that this is not how it really works, you can't send the QueryClient from the server to the client and you don't really want to do that.

Tanstack actually provides a remix example in their post about SSR: https://tanstack.com/query/latest/docs/framework/react/guides/ssr

As a note, and you should not do this for this question, but you can pass stuff from the server to the client in remix by just returning it in the loader. So if you export it somewhere on the server, import it via a loader and return it, it will be accessible on the client. This wouldn't work for react-query but might be useful for other things.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: Dumblydorr