React setState更新数组中的某个元素Element item
- var items = this.state.items;
- items[i].status = 'doing';
- this.setState({
- items: items
- });
//this.state.useLists[index].status === '10'?
let items = this.state.useLists;
items[index] === '10' ? items[index] = '20' : items[index] = '10';
this.setState({
useLists:items
});