ReactDOMServer.renderToStaticMarkup with v3 #1730
Unanswered
meandillar
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have an API route set up in Next.js which uses
ReactDOMServer.renderToStaticMarkup
to generate static html for some select components for use in an external application. Some of these components haveuseQuery
calls which I need when using the components normally.In React Query v2 the data from the
useQuery
calls was undefined when rendering to string, which is to be expected, and no errors were thrown. In v3 however it throws the dreadedNo QueryClient set, use QueryClientProvider to set one
. I understand the reason why it's throwing - I'm rendering the components as a string and there's no provider, but I'm wondering if it's possible to bypass the error without having to move alluseQuery
calls outside of the components and feed in as props, like we could do in v2.Beta Was this translation helpful? Give feedback.
All reactions