#how to use createResource in Astro SSR

1 messages · Page 1 of 1 (latest)

loud vale
#

I’d like to use createResource in Astro. Right now I’m doing the data fetch in the Astro file and passing it to the Solid component as an attribute but it’s a 20kb response. I’d prefer if solid instead fetched the data and rendered the output with it and then only the final HTML was shipped down with the JavaScript to load the page. It would save a lot of time on download and parsing. How can I do this?

soft parcel
#

Astro doesn't do async SSR or streaming SSR so you can't use createResource in SSR

loud vale
#

Well you can. You just need to pass initialData, and ssrLoadFrom = initial.

soft parcel
#

on top of that, the data is serialized twice: for Astro and for Solid