Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
primogenial
/
wp-content
/
plugins
/
elementor
/
app
/
modules
/
kit-library
/
assets
/
js
/
hooks
:
use-debounced-callback.js
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
import { useRef, useCallback } from 'react'; export default function useDebouncedCallback( callback, wait ) { const timeout = useRef(); return useCallback( ( ...args ) => { const later = () => { clearTimeout( timeout.current ); callback( ...args ); }; clearTimeout( timeout.current ); timeout.current = setTimeout( later, wait ); }, [ callback, wait ], ); }