Hacker News new | past | comments | ask | show | jobs | submit login

Its not an optimisation, its about state management.

React can’t see the difference between a reorder and remove&insert. When reordering items the state should be moved as well; when removing and inserting a new item, state should reset.

Using an array index is equivalent to silencing the error




Not necessarily.

It depends on what your data source is. If it’s a stable sorted list that only ever gets appended at the end, you can use the index.

At the end of the day, there is no hard fast rule for the key. You have to know what your data source is.

You have to know what you’re doing.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: