how to use prev state in use state hook react code example
Example: prevstate in usestate
const [prevState, setState] = React.useState([]);
setState(prevState => [...prevState, 'somedata'] );
const [prevState, setState] = React.useState([]);
setState(prevState => [...prevState, 'somedata'] );