Sorry, I really miss something with the transmission of state
within props
of sub components in React.
I have implemented a version of a todo l
As the other answers stated, the Array push
method does not return the array. Just to complement the answers above, if you are using ES6, a nice and elegant way of doing this is using the spread operator (you can read more about it here)
this.setState({
tasks: [...this.state.tasks, task]
})
It is essentially the same as using the concat
method, but I think this has a nicer readability.