In Chapter 9, Improve the Performance of Your Applications, which talks about performance and the reconciler, we saw how we can help React figure out the shortest path to update the DOM by using the key prop.
The key property uniquely identifies an element in the DOM, and React uses it to check if the element is new, or if it has to be updated when the component properties or state change.
Using keys is always a good idea and, if you don't do it, React gives a warning in the console (in development mode). However, it is not simply a matter of using a key; sometimes, the value that we decide to use as a key can make the difference. In fact, using the wrong key can give us unexpected behaviors in some instances. In this section, we will see one of those instances.
Let's, again, create a List component, as shown here:
class List extends PureComponent...