Ramonda

duplicate-key-among-siblings

This fails the run. Where it is wrong about your code, // ramonda-check-ignore <reason> on the line says so, and the reason is printed on every run.

Reported when two children written side by side claim the same literal key.

The framework reports the same fault while running, as RMD002 — but only once the line actually runs. This is the same fault proved from the source instead.

A key is how the diff decides that the node it is looking at is the node it saw last time. Two children claiming the same one means only one can be matched: the other is treated as new, so its state and its DOM go to a node that is not it — a half-typed input, an open menu, a scroll position, all landing on the wrong child while the page still looks right.

Keys have to be unique among SIBLINGS, and only among siblings — the same key under a different parent is a different key and is fine.

A key this cannot read is never compared: key={row.id} may collide at run time, and deciding that needs the data.

Next