Embedded Component Examples
Here's an embedded component (Greeter.svelte
)
And here's that same component embeded once again, but with different props
Lastly, a second embedded component
Interesting notes on the output code
- Although the same component is embedded here twice (
Greeter.svelte
), the component's source code is only generated once (as is necessary).
- Two Svelte components exist on this page, but the Svelte utility code exists only once. This is because all Svelte code for a single page is built in a single Rollup build, which allows Rollup to properly de-dupe and tree-shake the code. No unnecessary code bloating up the page.