Skip to content

Commit a7dd227

Browse files
mindronesConduitry
authored andcommitted
Docs: document rest in array/object destructuring in each blocks (#2676)
1 parent fee4d35 commit a7dd227

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

site/content/docs/02-template-syntax.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,20 @@ If a *key* expression is provided — which must uniquely identify each list ite
188188

189189
---
190190

191-
You can freely use destructuring patterns in each blocks.
191+
You can freely use destructuring and rest patterns in each blocks.
192192

193193
```html
194194
{#each items as { id, name, qty }, i (id)}
195195
<li>{i + 1}: {name} x {qty}</li>
196196
{/each}
197+
198+
{#each objects as { id, ...rest }}
199+
<li><span>{id}</span><MyComponent {...rest}/></li>
200+
{/each}
201+
202+
{#each items as [id, ...rest]}
203+
<li><span>{id}</span><MyComponent values={rest}/></li>
204+
{/each}
197205
```
198206

199207
---

0 commit comments

Comments
 (0)