react-use-hash-key
v1.0.3
Published
Generate unique key for many components.
Downloads
5
Maintainers
Readme
react-use-hash-key
Installation
npm install react-use-hash-key
yarn add react-use-hash-key
Usage
import {useHashKey} from 'react-use-hash-key';
const obj = [
{
id: "1",
title: "My title"
},
{
id: 2,
title: "My title"
},
]
function Component1() {
return obj.map(ent => <MyComponent key={useHashKey(ent.id)} />)
}
function Component2() {
return obj.map(ent => <MyComponent key={useHashKey(ent.title)} />)
}