我想将新的键值添加到数组中?我在下面告诉你我想做什么。我怎样才能做到这一点?1. 构造方法中的起始状态
`this.state = {
files: []
}'
在我使用活动文件设置状态之后
this.setState({files: activeFiles})
屏蔽我的状态
{ files: [ { key1: val1, key2: val2, key3: val3 }, { key1: val1, key2: val2, key3: val3 }, { key1: val1, key2: val2, key3: val3 } ] }
如何为每个文件添加新的键值?我想要的状态
{ files: [ { key1: val1, key2: val2, key3: val3, key4: val4 }, { key1: val1, key2: val2, key3: val3, key4: val4 }, { key1: val1, key2: val2, key3: val3, key4: val4 } ] }