I have an array inside an state which is an associative array. I want to insert values into this array when an event occurs.
State Declaration I used.
state = {
array: [{
aaa: '',
bbb: ''
}]
};
Function which is supposed to insert values to the array inside state.
reader.onload = (e) => {
var newArray = {
aaa: new_aaa,
bbb: new_bbb
}
this.setState({
array: this.state.array.concat(newArray)
});
}
Somehow , it isn't working ^_^