React has been quite nice, and very fast to work on. But there&#x27;s one aspect that&#x27;s concerning.<p>You have state and props, and the React tree diffing algorithm attempts to make some minimal set of changes that preserves state. However this algorithm is a heuristic, and so it&#x27;s possible to hit a case where your component gets a different component&#x27;s state.<p>For example, say there&#x27;s a text field which has keyboard focus. Another text field is added above it: the keyboard focus should stay in the bottom text field. But React has no notion of identity and doesn&#x27;t know whether the top or bottom text field is new. All it sees is a diff from one text field to two, and who knows which one will get focus!<p>React&#x27;s answer to this is to introduce identity by assigning each component a key, and that works. But this is reactive: I notice a bug, and fix that case by assigning a key, but still most elements do not have a key and it is not reasonable to add one. I&#x27;m stuck hoping that the opaque tree-diffing heuristic is correct enough for my case.<p>How do other React users handle this? How do you go from &quot;seems to work&quot; to &quot;I am certain React&#x27;s tree diff will assign the right state to the right components in all cases?&quot;