I couldn't find what is wrong, can't see which line has problem in jsbin. http://jsbin.com/bewigabomi/edit?js,console,output
class HelloWorldComponent extends React.Component {
constructor(){
super()
this.handleChange = this.handleChange.bind(this)
}
handleChange(e){
console.log(e.target.value)
}
render() {
const data = {
"fruits":[
{"name":"banana","value":true},
{"name":"watermelon","value":false},
{"name":"lemon","value":true},
]
}
return (
{data.fruits.map(obj =>
<div>
<label>{obj.name}</label>
<input onChange={(e) => this.handleChange(e)} type="checkbox" defaultChecked={obj.true}/>
</div>
)}
);
}
}
React.render(
<HelloWorldComponent/>,
document.getElementById('react_example')
);
Tried for more than 15min, couldn't spot the problem, need help!