DEV Community

Discussion on: Implementing advanced usePrevious hook with React useRef

Collapse
 
astrot1988 profile image
astrot1988 • Edited

const [state, setState] = useState();

const handleSetValue = (value: any)=>{
setState(prev => ({
prev: prev?.current,
current:value
}))
}