import { useEffect , useRef } from 'react' ; const usePrevious = < T > ( value ) => { const ref = useRef < T > ( ) ; useEffect ( ( ) => { ref . current = value ; } ) ; return ref . current ; } ; export default usePrevious ;