Skip to content

Using object-hash in react children map #110

@SouroucheB

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

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