如何从反应js中的map函数传递checkbox值

时间:2017-03-10 07:08:00

标签: reactjs

代码:

var list = this.state.data.map(function(value, idx){
  return(
    <ul style = {common}>
      <li><input type="checkbox" value={value.id} onChange={this.displayAlert.bind(this, value.id)}/></li>
      <li>{value.id}</li>
      <li>{value.Name}</li>
      <li>{value.points}</li>
      <li>{value.nationality}</li>
    </ul>
  )
}, this)

return (
  <div>
    <div>{list}</div>
    <button onClick ={  this.deleteHandler.bind(this)}>delete</button>
  </div>
)

0 个答案:

没有答案