Keys
key returns anything comparable with Map semantics (===, NaN equal to NaN): numbers, strings, symbols, objects.
key returns anything comparable with Map semantics (===, NaN equal to NaN): numbers, strings, symbols, objects. It runs untracked, once per item per update.
- Use a stable identity from your data (a database id), not the array index. A key that changes when the item moves defeats the purpose.
- Keys must be unique. A repeated key still renders every item, but the later copies get a fresh row on every update (they are never reused), and development builds warn once with EACH_KEY_DUPLICATE.
- A new object under an existing key updates the row's
item()accessor; the row, its DOM and its component state stay.