How unique must a key/id be in React?

438 views Asked by At

So, i usually make super-duper unique ids and keys for components that need it. But I wonder, how unique do they need to be? If they don't live in the same parent, is it important that they are different?

Please share you experience and thoughts :)

1

There are 1 answers

1
hitmanche On

No, it doesn't matter. I've done performance tests on it. The fact that it is in a unique div other than the component you gave the key is enough to distinguish it for the DOM.