Loading data in an SSR'ed component #9204
-
I have a component that injects a photo gallery based on a keyword string in a blog post. It works fine when I use onMount but I want to have this pre-rendered/SSR as my whole site is static. I can't figure out how to make it work. I saw this thread but I wasn't able to get it working for my use case: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Unfortunately, I don't think there is data loading at the component level. It is only for pages and layouts. |
Beta Was this translation helpful? Give feedback.
-
Its actually better for page performance to fetch all the data in parallel for your page using the load functions. Slow /non-important requests can be streamed https://svelte.dev/blog/streaming-snapshots-sveltekit |
Beta Was this translation helpful? Give feedback.
Unfortunately, I don't think there is data loading at the component level. It is only for pages and layouts.
See the following regarding data loading https://kit.svelte.dev/docs/load