set usestate arrow function state code example
Example: prevstate in usestate
const [prevState, setState] = React.useState([]);
setState(prevState => [...prevState, 'somedata'] );
const [prevState, setState] = React.useState([]);
setState(prevState => [...prevState, 'somedata'] );