docs: clarify ordering of attributes with spread (#15917)

pull/15939/head
Rich Harris 4 months ago committed by GitHub
parent ae71152013
commit 17a7cf51e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -82,12 +82,14 @@ As with elements, `name={name}` can be replaced with the `{name}` shorthand.
<Widget foo={bar} answer={42} text="hello" />
```
## Spread attributes
_Spread attributes_ allow many attributes or properties to be passed to an element or component at once.
An element or component can have multiple spread attributes, interspersed with regular ones.
An element or component can have multiple spread attributes, interspersed with regular ones. Order matters — if `things.a` exists it will take precedence over `a="b"`, while `c="d"` would take precedence over `things.c`:
```svelte
<Widget {...things} />
<Widget a="b" {...things} c="d" />
```
## Events

Loading…
Cancel
Save