@awsui/components-react
Version:
AWS UI is a collection of [React](https://reactjs.org/) components that help create intuitive, responsive, and accessible user experiences for web applications. It is developed by Amazon Web Services (AWS). This work is available under the terms of the [A
16 lines (15 loc) • 507 B
JavaScript
import { useCallback, useRef } from 'react';
import debounce from '../../debounce';
export function useDebounceCallback(callback, delay) {
var callbackRef = useRef();
callbackRef.current = callback;
return useCallback(debounce((function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (callbackRef.current) {
callbackRef.current.apply(callbackRef, args);
}
}), delay), []);
}