Is it keys should be globally unique?

  • Yes, always
  • No, never
  • It depends on the use case
In React, keys should be globally unique whenever possible. This helps React identify which items have changed, added, or removed from a list, and update the UI accordingly. While keys do not have to be globally unique in all cases, it is generally a best practice to use unique keys whenever possible.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *