will below code work? Saw it somewhere not sure why the author did that
this.setState({
messages: this.state.messages.concat({
text: 'new message'
})
})
Normally I'll do
this.setState({
messages: [
...this.state.messages,
{text: 'new messages'}
]
})
which one is appropriate?