This is not really a React specific question, but I think it helps to know the context. In a component I'm generating some table rows. Each row needs an onClick function that passes an id to the components handleUnlink method.
I got it to work with the code below, but it's making my head spin a bit and I have a feeling that this could be done in a simpeler way. Am I right?
var fn = function(id){
return function(){
this.handleUnlink(id);
}.bind(this);
}.bind(this);
var linkedListHtml = this.state.linkedList.map( p => {
return(
<tr key={p.id}>
<td>{p.name}</td>
<td><mui.Icon icon='action-highlight-remove' onClick={fn(p.id)}/></td>
</tr>);
});