Write it like this:
const renderList = (status, i) => {
//how to get the index here?
console.log('status', status, i)
}
return(
typeList.map(renderList)
)
Check this example:
function fun(item, i){
console.log('item', item, i);
}
a = [1,2,3,4,5];
a.map(fun);
Check the react component:
class App extends React.Component {
_createList(item, index) {
return <div>{item}: {index}</div>
}
render() {
return (
<div>
{[1,2,3,4,5].map(this._createList)}
</div>
)
}
}
ReactDOM.render(<App />, document.getElementById('container'));
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
<div id='container'>