react-async-ssr icon indicating copy to clipboard operation
react-async-ssr copied to clipboard

Data loading solutions?

Open overlookmotel opened this issue 5 years ago • 3 comments

I've just published react-lazy-data, a package to handle async data fetching which works well with react-async-ssr.

However, I'd be really interested to hear from anyone who has found any other solution for this.

I suspect that other data loading packages (e.g. apollo, react-query) may work with react-async-ssr already, or could be quite easily modified to do so.

Please let me know if I'm right!

overlookmotel avatar Apr 06 '20 00:04 overlookmotel

@revskill10 You mentioned in https://github.com/overlookmotel/react-async-ssr/issues/2#issuecomment-472098532 a while ago that you had this working with apollo. Can you share some details please?

overlookmotel avatar Apr 06 '20 00:04 overlookmotel

Hi @overlookmotel, I find this lib very useful, and I use it in prod.

here's an example project of the approach I'm using. I would be happy to get your feedback...

common utilities

defining the closure which aggregate resources in the server

providing the closure in ssr(using renderToStringAsync)

passing the serialized resources through the template

loading the resources on hydration

and finally: consuming in a function component

selama avatar Jul 27 '20 11:07 selama

@selama awesome! thanks for sharing! it was just what I was looking for!

codler avatar Sep 30 '20 09:09 codler