I am using index to generate key in a list. However, es-lint generates an error for the same. React doc also states that using the item index as a key should be used as last resort.
const list = children.map((child, index) =>
<li key={index}> {child} </li>);
I considered using react-key-index
.
npm install react-key-index
gives following error:
npm ERR! code E404
npm ERR! 404 Not Found: react-key-index@latest
Are there any suggestions on other packages that allow to generate unique key? Any suggestion on react key generator is appreciated!