react js prevstate with useSTate code example
Example: prevstate in usestate
const [prevState, setState] = React.useState([]);
setState(prevState => [...prevState, 'somedata'] );
const [prevState, setState] = React.useState([]);
setState(prevState => [...prevState, 'somedata'] );