import * as React from 'react' ; const { useRef , useEffect } = React ; function usePrevious < T > ( value ) { const previousValue = useRef ( value ) ; useEffect ( ( ) => { previousValue . current = value ; } , [ value ] ) ; return previousValue . current ; } export default usePrevious ;