
/* 
  This is the usePrevious hook.
  It contains the following components:
  - usePrevious
*/
import { useRef, useEffect } from 'react'

// Define the usePrevious hook
function usePrevious<T>(value: T): T | undefined {
    const ref = useRef<T>(value)
    useEffect(() => {
        ref.current = value
    }, [value])

    return ref.current
}

export default usePrevious 