I really like the new React hooks and I\'m using them frequently for a project I\'m working on. I\'m coming across a situation where I want to use the prevState in the
state updater from useState provides a callback pattern which returns you the previous state which you can use to update the current state
state updater
useState
const [ someState, setSomeState ] = useState( new Map() ) setSomeState(prevState => prevState.set( key, value ) )