1.0.2 • Published 1 year ago

react-use-hash-key v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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)} />)
}