Workaround for event cannot be associated in the variable map in the render function in react
As shown in the code below, the checkbox for input can display 3 normally, but cannot be associated with HandleChange. Because the code does not display properly, I use the picture
var Input = reactbootstrap.input;
var testcom = React.createclass ({
Getinitialstate:function () {
return {value: ' hello! ',
value2: ' Nihao2 '
};
},
Handlechange:function (event) {
var debug = 1;
Console.log (event);
Console.log (Event.target);
Console.log (event.target.checked);
},
Render:function () {
var sortedprocessarray = [' Alice ', ' Emily ', ' Kate '];
Return (
{
Sortedprocessarray.map (function (item) {
return;
})
}
);
}
});
React.render(<TestCom/>, document.body);</script>
Workaround, do not return at the time of map. Instead, save the result of the map to a variable and return the variable. That's it.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Workaround for event cannot be associated in the variable map in the render function in react