From e05a695519709ddb20529142a66a71f25d5ba70d Mon Sep 17 00:00:00 2001 From: Bashu Naimi-Roy Date: Sun, 23 May 2021 22:11:32 -0400 Subject: [PATCH] clarify keyed each block tutorial text --- site/content/tutorial/04-logic/05-keyed-each-blocks/text.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/content/tutorial/04-logic/05-keyed-each-blocks/text.md b/site/content/tutorial/04-logic/05-keyed-each-blocks/text.md index 41801db6e2..b990dead95 100644 --- a/site/content/tutorial/04-logic/05-keyed-each-blocks/text.md +++ b/site/content/tutorial/04-logic/05-keyed-each-blocks/text.md @@ -6,7 +6,7 @@ By default, when you modify the value of an `each` block, it will add and remove It's easier to show why than to explain. Click the 'Remove first thing' button a few times, and notice what happens: It removes the first `` component, but the *last* DOM node. Then it updates the `name` value in the remaining DOM nodes, but not the emoji. -Instead, we'd like to remove only the first `` component and its DOM node, and leave the rest unaffected. +Instead, we'd like to remove only the first `` component and its DOM node, and leave the others unaffected. To do that, we specify a unique identifier (or "key") for the `each` block: @@ -16,6 +16,6 @@ To do that, we specify a unique identifier (or "key") for the `each` block: {/each} ``` -Here, `(thing.id)` is the key, which tells Svelte how to figure out which DOM node to change when the component changes. +Here, `(thing.id)` is the *key*, which tells Svelte how to figure out which DOM node to change when the component updates. > You can use any object as the key, as Svelte uses a `Map` internally — in other words you could do `(thing)` instead of `(thing.id)`. Using a string or number is generally safer, however, since it means identity persists without referential equality, for example when updating with fresh data from an API server.