Svelte · Middle · Question 15 of 75
What is an advantage of snippets over Svelte 4 slots?
- ✓Correct answer: They are values: you can pass parameters, pass them as props, type them with
Snippet<[T]>and reuse them in the same component - 2They are rendered on the server only
- 3They don't need a parent component
Explanation
Top-level snippets can even be referenced inside <script>, and exported from <script module> if they don't use component state.