I am just curious as to whether it is bad (or better) practice to keep this.setState on one line of code, especially if only one state variable is being changed.

this.setState({
      fruits: { apples: newApples, bananas: newBananas }
    });

vs

this.setState({fruits: { apples: newApples, bananas: newBananas }});

1 Answers

-1
Fernando Montoya On

Not, it is not, you or your team defines it. You can also use a formatter like https://prettier.io/ to do it for you.