Index As Keys Aren't Too Bad (React)

When the array mutates, index variable is changed. Why don’t we just assign the initial index number-type value to a static constant, then use that as our index key? It won’t change!

Also, apparently, when using index as key, if no state is present

If you delete the first item, then react will conclude that ALL items now have a new text, and will re-render ALL remaining items

javascript - The importance of component keys in React.js - Stack Overflow

Why is this only the case with indexs as keys? This is obviously false, the same issue would be true with using anything else as keys.

This doesn’t help answer my question at all… :face_with_diagonal_mouth:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.