Skip to content

Using object-hash in react children map #110

Description

@SouroucheB

Hi,

I wanted to know if I could use object-hash in something like this in React :

children.map((child, index) => (
    <Component
        key={hash(`${index}-{child.name}`)}
    />
)

And be sure that the key will always be unique and make possible to avoid the following problem : https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md

TYVM
Sourouche

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions