T026warning

p-for without p-key

A p-for loop has no p-key.

Without a key, the loop index is used to match items between renders. When items are added, removed or reordered, that can reuse the wrong element and lose its state, and it does more work.

Add a p-key bound to a value that identifies each item, such as its ID.

$ piko explain T026

Build output ends each diagnostic with a link to this page, and editors using the Piko language server link the code under the squiggle. Look for CodeMissingLoopKey in Piko's source to see where it is reported.