Keys

React uses keys to help with Reconciliation (i.e. how it calculates the DOM diff for each render).

  • Duke
  • Villanova

As noted in ‘What should I use for a key?’ Be careful what you use for a key. Using an array index isn’t a best practice… aim to use a unique id.

Why can’t i put key in default props (or define the default somewhere else)?

What should I use for a key?

What are some examples where I should manually change a key?

Do keys across an app all need to be unique?

No - Keys used only need to be unique among their siblings.

More info: https://facebook.github.io/react/docs/lists-and-keys.html#keys-must-only-be-unique-among-siblings