Skip to content

Commit

Permalink
Docs: document rest in array/object destructuring in each blocks (#2676)
Browse files Browse the repository at this point in the history
  • Loading branch information
mindrones authored and Conduitry committed Jun 22, 2019
1 parent fee4d35 commit a7dd227
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion site/content/docs/02-template-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}
```

---
Expand Down

0 comments on commit a7dd227

Please sign in to comment.