-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Suggestion: Allow svelte:fragment
to be used as returned component value for this
prop in svelte:component
#7396
Comments
this
prop in svelte:componentsvelte:fragment
to be used as returned component value for this
prop in svelte:component
Here it is in practice (the workaround): https://svelte.dev/repl/17594118f02f4c4f808c1e98ed95e261?version=3.46.4 |
when you write <Component>
<svelte:fragment slot="xxx">
<div />
<div />
</svelte:fragment>
</Component> it is a construct in compile time to group elements together, but you wont see a trace of it after it is being compiled.
so thank you and im closing this :) |
@tanhauhau May I then revise the spec for this feature request to make the So this example (below) would simply render <svelte:component this={false && MyComponent}>
Some text
</svelte:component> The same would be true for |
@tanhauhau This issue was resolved effectively. I'll create a new feature suggestion for the new spec. Thanks as always! |
Describe the problem
For situations where I want to conditionally wrap on element in a component, or leave it as-is, unwrapped, I see a lot of value in svelte:fragment being accepted as a valid
this
prop value forsvelte:component
.In other words, I would naturally expect this to work, but it does not appear to:
Describe the proposed solution
I would like to see support for
svelte:fragment
within thethis
prop ofsvelte:component
components added, which would naturally allow the optional wrapping of nodes.Alternatives considered
The main alternative is see is quite similar but essentially creating my own
Fragment
component which simply returns the slotted content in this format:In practice, it could be used like this:
Importance
would make my life easier
The text was updated successfully, but these errors were encountered: