-
-
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
docs: clarify let: directives #8495
Conversation
@jamesscottbrown is attempting to deploy a commit to the Svelte Team on Vercel. A member of the Team first needs to authorize it. |
Co-authored-by: Ben McCann <[email protected]>
Co-authored-by: gtmnayan <[email protected]>
|
||
The `let:` directive gives a slot template access to variables defined in the component that they are provided to. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find this sentence much harder to read/parse than the previous one. Can we find some kind of middle ground between what was there before and what's proposed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The `let:` directive gives a slot template access to variables defined in the component that they are provided to. | |
The `let:` directive gives a slot template access to variables passed down by the parent component. |
Hi! Could you resolve merge conflicts? The file structure has changed, so you may wanna move these changes to |
Hi @jamesscottbrown. Are you still interested in pursuing this PR? If so, the merge conflicts will need to be addressed |
|
Thank you. I agree with your points, though I also agree with the comments saying that the proposed change makes things less clear. I've opened #14543 which updates the current docs with changes inspired by these ones; since this PR is stale I'll close it |
This tries to clarify the explanation of
let:
directives through 3 changes:prop
for the specific prop in the example. Using the generic nameprop
might make a reader wonder if this is a keyword or magic name choice that needs to be usedI found the statement "Slots can be rendered zero or more times and can pass values back to the parent" initially unclear because there are two dfferent child-parent relationships to consider (a component definition with a child
<slot>
, and a use of the component with a child slot template).I think these changes are helpful because this syntax is inherently somewhat confusing: as noted in #4125,
let:foo={bar}
definesbar
to be a new variable set to the value offoo
, which is counter-intuitive.