svelte icon indicating copy to clipboard operation
svelte copied to clipboard

docs: clarify let: directives

Open jamesscottbrown opened this issue 1 year ago • 1 comments

This tries to clarify the explanation of let: directives through 3 changes:

  • use a name other than prop for the specific prop in the example. Using the generic name prop might make a reader wonder if this is a keyword or magic name choice that needs to be used
  • add some comments to the example
  • re-phrases the explanation to avoid the reader having to think about which direction is backwards

I 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 https://github.com/sveltejs/svelte/pull/4125, let:foo={bar} defines bar to be a new variable set to the value of foo, which is counter-intuitive.

jamesscottbrown avatar Apr 12 '23 16:04 jamesscottbrown

@jamesscottbrown is attempting to deploy a commit to the Svelte Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Apr 12 '23 16:04 vercel[bot]

Hi! Could you resolve merge conflicts? The file structure has changed, so you may wanna move these changes to documentation/docs/02-template-syntax/07-special-elements.md 😁

PuruVJ avatar Jul 17 '23 07:07 PuruVJ

Hi @jamesscottbrown. Are you still interested in pursuing this PR? If so, the merge conflicts will need to be addressed

benmccann avatar Oct 27 '23 14:10 benmccann