import { EffectCallback , DependencyList , useRef , useEffect } from 'react' ; export const useDebounceEffect = ( effect , delay , deps ? ) => { const interval = useRef < NodeJS . Timeout | null > ( null ) ; useEffect ( ( ) => { if ( interval . current !== null ) { clearTimeout ( interval . current ) ; } interval . current = setTimeout ( ( ) => { effect ( ) ; } , delay ) ; } , deps ) ; } ;