I use the following code in react in order to update state. state should finally looks like this:
state
this.state.output = { \'abc\':{ value: 10 }
object spread syntax is recent spec. Here is the documentation for it: using-object-spread-operator
Below code uses Object.assign method instead :
Object.assign
handleChange = (data) => { this.setState(prevState => ({ output: Object.assign({}, prevState, { [data.id]: data }) }) )}