ConsoleTVs / sswr

🔥 Svelte stale while revalidate (SWR) data fetching strategy
MIT License
234 stars 11 forks source link

Add SvelteKit SSR example to README #32

Closed khromov closed 2 years ago

khromov commented 2 years ago

Turns out it's super easy and convenient to combine sswr with server-side fetching in SvelteKit!

ConsoleTVs commented 2 years ago

Why is all the fuzz needed? Wound't just passing down the prop from server and then using it in initialData do the trick already?

khromov commented 2 years ago

@ConsoleTVs Thanks for the merge. I tried only setting initialData, but it still wouldn't render the data in the HTML, so there was a "flash of no data" when loading the page.

It's probable this could be fixed with some SvelteKit-specific integration point in sswr.

ConsoleTVs commented 2 years ago

@khromov I have updated your SSR example. Please check it out and let me know!