utils.usePrevious.ts Maven / Gradle / Ivy
The newest version!
import { useRef } from 'react'
export function usePrevious(value: T) {
const ref = useRef()
const prevValue = ref.current
ref.current = value
return prevValue
}