@googleforcreators/react
Version:
A tiny wrapper package that re-exports React and provides additional utilities and custom hooks.
16 lines • 954 B
TypeScript
import type { DependencyList } from 'react';
/**
* The same as `useCallback` except that it ensures the updates
* are batched. Use anywhere where the native DOM events are handled
* or for microtasks.
* See https://blog.logrocket.com/simplifying-state-management-in-react-apps-with-batched-updates/.
*
* @param callback The callback to be batched and memoized.
* @param [deps] The optional callback dependencies.
* @return The memoized batching function.
*/
declare function useBatchingCallback<T, S = void>(callback: (arg: T) => S, deps: DependencyList): (arg: T) => S;
declare function useBatchingCallback<T, U>(callback: (arg1: T, arg2: U) => void, deps: DependencyList): (arg1: T, arg2: U) => void;
declare function useBatchingCallback<T, U, V, S = void>(callback: (arg1: T, arg2: U, arg3: V) => S, deps: DependencyList): (arg1: T, arg2: U, arg3: V) => S;
export default useBatchingCallback;
//# sourceMappingURL=useBatchingCallback.d.ts.map