prevstate + 1 in react useState code example
Example 1: prevstate in usestate
const [prevState, setState] = React.useState([]);
setState(prevState => [...prevState, 'somedata'] );
Example 2: this.setstate prevstate
this.setState(prevState => ({ n: !prevState.n }))