const [prevState, setState] = React.useState([]);
setState(prevState => [...prevState, 'somedata'] );
const [count, setCount] = useState(0) // count = 0
setCount(prevCount => prevCount + 1) // count = 1
this.setState(prevState => ({ n: !prevState.n }))