Let\'s say I have a list of plain objects in my this.state.list that I can then use to render a list of children. What then is the right way to insert object in
this.state.list
setState() can be called with a function as a parameter:
this.setState((state) => ({ list: state.list.concat(newObj) }))
or in ES5:
this.setState(function(state) { return { list: state.list.concat(newObj) } })