In the React docs, I came across this example of an arrow function. After the =>, the state object is wrapped in parentheses. Are they necessary? And, if so, do the parentheses change how the arrow function works?
Different than?:
this.setState((prevState, props) => {
//code
});
Would the code without the parentheses run properly?
The sample code returns an object.
The longer version would be:
this.setState((prevState, props) => {
return { counter: ... };
});