In this article, we will see how we can use the new ES6 shorter syntax which will make the setState call a lot simpler. So Let’s start with some background knowledge. Take a look at below arrow function. const getName = () => { return "David"; } The...

Markdown supported · ⌘↵ to post
Darlan Tódero ten Caten
Entrepreneur & Software Engineer
Good content, I agree and already use the tips in my code.
The last example can be even shorter (and easy to read) because you are not using the prevState:
this.setState({ numbers: [] });