Replies: 1 comment
-
I feel like that'd either discourage people from making large snippets or result in overly complex code. If you want to prevent helper snippets from becoming props, you could do something like this, where you put the helper inside the snippet: <Component>
{#snippet children()}
{#snippet helper()}
...
{/snippet}
{@render helper()}
{/snippet}
</Component> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm not a fan of implicit snippet props on components because they're really easy to confuse with a "locally-declared" snippet meant to be used in children markup:
Instead I think snippet props should be applied within the component's opening tag (similar to
{@attach}
):Or maybe something like an "anonymous" snippet? (Would have to figure out a workable syntax):
This better conveys that a snippet is a one-off implementation intended only for use as a prop for a particular component instance.
Beta Was this translation helpful? Give feedback.
All reactions