Post

What's the motivation for Fragments? Their transform looks almost the same as a Component. If it's primarily a performance thing, I wonder if the transform could do this automatically instead of needing the explicit concept.

I've heard that feedback before, they're a way of creating JSX anywhere – as components can only be top-level in a module due to supporting styling via <script>

0 reposts0 likes

However, fragments are really useful for `<Component>` cases as forming the children prop to pass through (or $children in Ripple's case). We can't bass JSX as expressions, and you can't pass around statements, so it makes fragments required in these cases – just like Svelte 5's snippets.

Are they interchangeable? Here, in Svelte, is an issue that you cannot mount a snippet and @render a component, which often introduces extra friction. I personally think we should make them interchangeable, but it is a breaking change.

That’s not a bad idea. Maybe I can remove fragments entirely and just have components too for implicit children props. Hmm. Interesting. Then there’s even less custom syntax!