setting in state: this.state = {checkList: []};
checkList initializes it with an array of the same length as JsonPage: this.setState ({checkList:checkSaveCount}); / / checkSavaCount is the same length as the following JsonPage.
the following creates a set of Checkbox,check properties set to this.state.checkList [I] and binds the onChangeClick event.
{
var menuArr= [];
var chk=React.createElement (Checkbox, {id: "" + I ", checked:this.state.checkList [I], onChange:this.onChangeClick.bind (this)}, JsonPage [I]); Please enter the code
menuArr [I] = React.createElement (Menu.Item, {key:"+ i+"}, chk);
}
then the question arises: how to update the status of onChangeClick itself? is it feasible? how to write setState? if there is an all-selected checkbox, click to select all, and the checkList of setState is an array with all values of true, will the status of all the components created above be updated?