How and why to use keys in React
suggest changeIntroduction
Whenever you are rendering a list of React components, each component needs to have a key attribute. The key can be any value, but it does need to be unique to that list.
When React has to render changes on a list of items, it walks both lists of children and generates a mutation whenever there’s a difference. If the children have no keys, React matches them by index. With keys, React compares the keys to know which items were added, removed, or reordered. Keys must be unique among siblings, and they should be stable strings or numbers.
Remarks
For more information, visit this link to read how to use keys: https://facebook.github.io/react/docs/lists-and-keys.html
And visit this link to read why it is recommended to use keys: https://facebook.github.io/react/docs/reconciliation.html#recursing-on-children