lib/usePrevious.js
/**
 * Custom hook for getting previous value 
 * @template T
 * @param {T} value 
 * @returns previous value
 */
Custom hook for getting previous value
@template T
@param {T} value
@returns previous value
Custom hook for getting previous value @template T @param { T } value @returns previous value
function usePrevious(value) {
    const ref = useRef(value);
    useEffect(() => {
      ref.current = value;
    });
    return ref.current;
}
function usePrevious ( value ) { const ref = useRef ( value ) ; useEffect ( ( ) => { ref . current = value ; } ) ; return ref . current ; }
Custom hook for getting previous value
 @template T
 @param {T} value
 @returns previous value
Custom hook for getting previous value @template T @param { T } value @returns previous value