react-native-sortables
Version:
Powerful Sortable Components for Flexible Content Reordering in React Native
16 lines (15 loc) • 475 B
JavaScript
;
import { useRef } from 'react';
import useStableCallback from './useStableCallback';
export default function useDebouncedStableCallback(callback, delay = 100) {
const timeoutRef = useRef(null);
return useStableCallback((...args) => {
if (timeoutRef.current) {
clearTimeout(timeoutRef.current);
}
timeoutRef.current = setTimeout(() => {
callback(...args);
}, delay);
});
}
//# sourceMappingURL=useDebouncedStableCallback.js.map