React performance implications of long key value on component React performance implications of long key value on component reactjs reactjs

React performance implications of long key value on component


The length of the string you use for your key should not impact performance at all.

Strings in Javascript are immutable and additionally modern Javascript engines use string interning, meaning that when your interpreter is checking whether '/some/url/ === '/some/other/url' it does not need to traverse each character in the array in O(n) linear time, but can simply check whether the two values are the same.

See this answer for more context: Do common JavaScript implementations use string interning?