Skip to content
This repository was archived by the owner on Feb 19, 2022. It is now read-only.
This repository was archived by the owner on Feb 19, 2022. It is now read-only.

004.1 Index as a key is an anti-pattern #17

Description

@pvienneau

May be outside the scope of your learning modules, but thought I'd drop this here in case you were interested.

https://medium.com/@robinpokorny/index-as-a-key-is-an-anti-pattern-e0349aece318#.9wchkw5td

It would be bad practise to use a mapping function's index as the keys to the generation of multiple children, as it may cause unexpected results when the data source would get updated, especially on the addition/removal of items. The fix would be to use some kind of id would within the data source that makes each item unique, though I understand that this may be outside the scope of your learning modules as you're surely trying to show the fundamentals of React.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions