Keys vs Ids #7147
-
I've noticed that React Aria Components (ListBox for example), and the new In contrast, Is there anything in particular that's motivated this difference? I've been messing around with the Additionally, since |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
It comes down to an implementation difference. The old collection implementation used by default in the hooks was able to use
Changing all of these APIs could be done, potentially in a breaking change release sometime down the line, but we have no plans to change it in the immediate future. Too big of a change for not enough benefit. |
Beta Was this translation helpful? Give feedback.
It comes down to an implementation difference. The old collection implementation used by default in the hooks was able to use
key
because it walked the JSX tree. However, this implemented prevented making wrapper components as expected with React (e.g.MyListBoxItem
wrappingItem
). We moved to another approach that fixed this problem by letting React render as normal instead of traversing the JSX tree, but React does not passkey
into components as a prop so we were forced to rename it toid
.Changing all of these APIs could be done, potentially in a breaking chan…