Examples · Basics

Keyed lists

list() keeps rows by key: add, remove and move without re-rendering the rest.

list() reconciles by key. A row is exactly the nodes you return; when the array changes, existing rows are kept, moved with the minimum number of DOM moves and only new rows are rendered.

Playground

What to notice

  • The row template receives the item and a lazy index signal.
  • Reversing the array moves nodes; open the frame's inspector and the li elements keep their identity.
  • Removing writes a new array; the removed row's scope is disposed with its listeners.

Add three items, reverse, then remove the middle one.