T
TanStack2y ago
sunny-green

Serialize dates with SSR / react-query

Is there a nice/automatic way to serialize/deserialize dates in react-query when doing SSR hydration? (I'm using next.js). useQuery doesn't seem to have a deserialize fn - so whatever gets put in there will be wrong. react-query in general doesn't seem well designed / thoughtful for SSR. Am I missing something?
2 Replies
absent-sapphire
absent-sapphire2y ago
superjson can do it
sunny-green
sunny-greenOP2y ago
I don't think this helps - I'm asking how I can avoid a manual deserialize step on the client side in every component that needs the data when using ssr data from react-query

Did you find this page helpful?