Skip to content
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

Svelte 5: Snippet Shorthand #12162

Closed
michealparks opened this issue Jun 24, 2024 · 2 comments
Closed

Svelte 5: Snippet Shorthand #12162

michealparks opened this issue Jun 24, 2024 · 2 comments

Comments

@michealparks
Copy link

Describe the problem

Over yonder in the Threlte repo we recently replaced Slots with Snippets in our next branch. One observation we had following this was about the increased verbosity surrounding slot props.

Stuff like this:

<Box let:width let:height>
  {...}
</Box>

Turned into this:

<Box>
  {#snippet children({ width, height })}
    {...}
  {/snippet}
</Box>

Describe the proposed solution

A large amount of our snippet usage seems to be passing props to child components using the default children snippet. It would be nice if a shorthand existed to reduce the verbosity a bit and make it quicker to read. Something like:

<Box>
  {#snippet({ width, height })}
    {...}
  {/snippet}
</Box>

Importance

nice to have

@michealparks michealparks changed the title Svelte 5: Default Snippet Svelte 5: Snippet Shorthand Jun 24, 2024
@7nik
Copy link

7nik commented Jun 24, 2024

A proposal that brings in implicitness only to drop one word doesn't seem to be good.

@trueadm
Copy link
Contributor

trueadm commented Jun 24, 2024

I'm sorry, this shorthand will bring more confusion than it's worth. Sometimes verbosity can be a good thing.

@trueadm trueadm closed this as completed Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants