Docs: document rest in array/object destructuring in each blocks (#2676)

pull/3077/head
Luca Bonavita 6 years ago committed by Conduitry
parent fee4d351e1
commit a7dd227336

@ -188,12 +188,20 @@ If a *key* expression is provided — which must uniquely identify each list ite
---
You can freely use destructuring patterns in each blocks.
You can freely use destructuring and rest patterns in each blocks.
```html
{#each items as { id, name, qty }, i (id)}
<li>{i + 1}: {name} x {qty}</li>
{/each}
{#each objects as { id, ...rest }}
<li><span>{id}</span><MyComponent {...rest}/></li>
{/each}
{#each items as [id, ...rest]}
<li><span>{id}</span><MyComponent values={rest}/></li>
{/each}
```
---

Loading…
Cancel
Save