I'm looping an object in reactjs and want to create checkboxes based on the object contents, associated with each checkbox an onChange event and i want to invoke a function there, what's the proper way to link my function with the event ?
Object.keys(obj).map((i, item) =>
{
$("#main").append("<input type='checkbox' value="+obj[i].Value+"
id="+obj[i].ID+" onChange="+{this.load.bind(this,obj[i].ID)}+" />");
});
this is where i get the binding error Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire