What is a potential bug you can introduce when using index as key Code Example
what is a potential bug you can introduce when using index as key
Reordering a list, or adding and removing items from a list can cause issues with the component state, when indexes are used as keys. If the key is an index, reordering an item changes it. Hence, the component state can get mixed up and may use the old key for a different component instance