1
ich eine state
der Komponente wie dieses:Wie aktualisiert man das State-Array?
constructor(props){
super(props)
this.state={
editableComparatorIndexes: []
}
}
Und Ich habe Probleme, die state
Aktualisierung, ich brauche so etwas zu tun:
onEditComparatorClicked(i) {
this.setState({editableComparatorIndexes[i]:1});
this.setState(this.state);
}
Immutable Version mit Doppel [Scheibe] (https: // developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice?v=control): '[... this.state.editableComparatorIndexes.slice (0, i), changedElement,. ..this.state.editableComparatorIndexes.slice (i + 1)] ' –