mirror of
https://github.com/sveltejs/svelte.git
synced 2024-12-01 17:30:59 +01:00
Tutorial: Description fix - each block bindings (#5974)
The chapter highlights event binding in `each` block which is missing within the snippet. Thus it seems reasonable to include it within the description snippet block.
This commit is contained in:
parent
ad29604d6b
commit
1a1f36edcf
@ -5,15 +5,17 @@ title: Each block bindings
|
||||
You can even bind to properties inside an `each` block.
|
||||
|
||||
```html
|
||||
<input
|
||||
type=checkbox
|
||||
bind:checked={todo.done}
|
||||
>
|
||||
{#each todos as todo}
|
||||
<input
|
||||
type=checkbox
|
||||
bind:checked={todo.done}
|
||||
>
|
||||
|
||||
<input
|
||||
placeholder="What needs to be done?"
|
||||
bind:value={todo.text}
|
||||
>
|
||||
<input
|
||||
placeholder="What needs to be done?"
|
||||
bind:value={todo.text}
|
||||
>
|
||||
{/each}
|
||||
```
|
||||
|
||||
> Note that interacting with these `<input>` elements will mutate the array. If you prefer to work with immutable data, you should avoid these bindings and use event handlers instead.
|
||||
> Note that interacting with these `<input>` elements will mutate the array. If you prefer to work with immutable data, you should avoid these bindings and use event handlers instead.
|
||||
|
Loading…
Reference in New Issue
Block a user