Reading this article about using the index
is a react key.
Let's say we have two lists:
<List1>
<el key="1" />
<el key="2" />
</List1>
<List2>
<other-el key="1" />
<other-el key="2" />
</List2>
Is it safe that elements from the two lists have the same keys
? Are the keys globally shared between elements or List1 keys are local to first list and List2 keys are local for the second list?
Would it be any better if the lists looked like this:
<List1>
<el key="1-1" />
<el key="1-2" />
</List1>
<List2>
<other-el key="2-1" />
<other-el key="2-2" />
</List2>