We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
direct/explicit
https://svelte.dev/docs/svelte/snippet#Passing-snippets-to-components
Would like to add a section to explain the direct/explicit method
let { foo } = $props(); {@render foo()}
As far as i can tell there are 3 ways, and the second one direct/explicit doesn't seem to be mentioned at all.
Currently is unclear what the various snippet options are in comparison to its counterpart {#if...} and {#each...}
{#if...}
{#each...}
// Parent.svelte <Child> <h1>Title!</h1> </Child> // Child.svelte <script> let { children } = $props(); </script> {@render children()}
// Parent.svelte <Child> {#snippet foo()} <h1>Title!</h1> {/snippet} </Child> // Child.svelte <script> let { foo } = $props(); </script> {@render foo()}
// Parent.svelte {#snippet foo()} <h1>Title!</h1> {/snippet} <Child {foo} /> // Child.svelte <script> let { foo } = $props(); </script> {@render foo()}
https://discord.com/channels/457912077277855764/1300850418728960000
annoyance
The text was updated successfully, but these errors were encountered:
As far as I can tell all of that is there.
Within the template, snippets are values just like any other. As such, they can be passed to components as props
As an authoring convenience, snippets declared directly inside a component implicitly become props on the component
Any content inside the component tags that is not a snippet declaration implicitly becomes part of the children snippet
Sorry, something went wrong.
Then I'm specifically asking about a code block example.
Secondary goal, I would like the various options to be more obvious, siting prior art like {#if...}
or export from mdn https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export
Successfully merging a pull request may close this issue.
TLDR
https://svelte.dev/docs/svelte/snippet#Passing-snippets-to-components
Would like to add a section to explain the
direct/explicit
methodExplanation
As far as i can tell there are 3 ways, and the second one
direct/explicit
doesn't seem to be mentioned at all.Currently is unclear what the various snippet options are in comparison to its counterpart
{#if...}
and{#each...}
Reference
https://discord.com/channels/457912077277855764/1300850418728960000
Severity
annoyance
The text was updated successfully, but these errors were encountered: