I\'m not sure I\'m doing the right thing, I mutate variable outside of setState, it\'s fine right? or there\'s more elegant way to do it?
state = { persons:
In my opinion, more elegant way would be to use functional setState:
setState
const newPerson = { name: '', age: -1 }; this.setState(prevState => ({ persons: [...prevState.persons, newPerson] })