#Dependency injection during SSR?
13 messages · Page 1 of 1 (latest)
How can I ensure that the same query client from the original request is being used in all of the rendering?
In psuedo code:
---
// [...path].astro
const queryClient = new QueryClient();
await queryClient.prefetch('...')
---
<ReactApp queryClient={queryClient} />
To my knowledge, astro will try to serialize the QueryClient as a prop into the HTML
What i want to do is be able to pass that reference during ssr, but not serialize it
Never mind. I found a workaround!
@thorny pelican What was the workaround you found? I was wanting to do this as well
I decided to add the necessary data to the dehydrate/hydrate functions I was using
So the SSR render is treated exactly the same as a client render.
Welcome btw @thorny pelican 👋
Woo!
Hey @thorny pelican , what do you mean with dehydrate/hydrate functions? I was wondering the same for using nanostores and pass the state reference during ssr without serializing it