I would like to use react-key-index extension in order to generate unique id's. I was trying to implement their sample example, but no matter what I do, it still throws me the same error:
TypeError: Hashids is not a constructor
link: react-key-index npmjs
Here is that pretty simple example:
App.js:
import React from 'react';
import keyIndex from "react-key-index";
import './App.css';
function App() {
let arr = ["one", "two", "three"];
arr = keyIndex(arr, 1);
const list = arr.map(arr => <li key={arr.id}>{arr.value}</li>);
return <ul>{list}</ul>;
}
export default App;
index.js:
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
ReactDOM.render(<App />, document.getElementById('root'));
serviceWorker.unregister();
Please, do you have any idea where do I do a mistake? I am trying to set it going in completely new react project (create-react-app). From my point of view i have implemented it correctly (but obviously i have not).
And here is how that error looks like in the browser: