Snippets like in Svelte 5? #11029
Replies: 3 comments 2 replies
-
That looks quite a lot like createReuseableTemplate from VueUse |
Beta Was this translation helpful? Give feedback.
-
Svelte is not a pioneer in this regard. Because, for example, it has already been available in Angular via ng-template/ng-container for years. The same in React, using jsx/tsx you can extract any reusable piece into a separate function. In general I like how createReuseableTemplate looks like and how it work with TS, but it would be nice to have it inbox but not as external dependency. |
Beta Was this translation helpful? Give feedback.
-
Snippets are more succint, cleaner and shorter, than reusable templates, would be a great adition |
Beta Was this translation helpful? Give feedback.
-
I just saw a video about Svelte 5. One of the new features shown was the support for snippets: https://svelte-5-preview.vercel.app/docs/snippets.
I really like this concept, as it makes it very easy to create small chunks of reusable template code directly in a component. In Vue, right now when I want to do something like this, I have to create a separate reusable component and pass props/slot content to it. Often this feels unnecessary when I just want to reuse that part of code in one single component.
It would be fantastic to have an equivalent to this kind of functionality in Vue! :)
What do you think? Or is there already something similar that I don't know of?
Beta Was this translation helpful? Give feedback.
All reactions