Hydration error
Answered
Chinese softshell turtle posted this in #help-forum
Chinese softshell turtleOP
When I am using the latest version of NextJS with React Query V5 (last version), there is a hydration error when using useQuery hook. I have tried disabling the query for server side, by setting
enabled: typeof window !== undefined
, but it didn't help8 Replies
Dutch
you can share error maybe @Chinese softshell turtle
Japanese flying squid
I faced a similar problem in my previous project. Can I see it?
@joulev https://tanstack.com/query/latest/docs/framework/react/guides/ssr
Chinese softshell turtleOP
The method mentioned in
Get started fast with initialData
section doesn't work in app router, since getServerSideProps
or getStaticProps
are not supportedAnswer
Chinese softshell turtleOP
Thanks, do you have any ideas on how to fix it?
im using react-query in prod and the only way to reliably fix all hydration errors due to react-query that i've found, is to follow the guide above closely and fully. i.e. with server side rendering and
HydrationBoundary
Chinese softshell turtleOP
got it, thanks