UNPKG

@react-hookbox/enhanced-callback

Version:

The enhanced version of useCallback that doesn't need deps array and keeps reference the same.

9 lines (8 loc) 343 B
declare type Fn = (...args: any[]) => any; declare type EmptyFn = () => any; interface EnhancedCallbackHook { <F extends EmptyFn>(fn: F): () => ReturnType<F>; <F extends Fn>(fn: F): (...args: Parameters<F>) => ReturnType<F>; } export declare const useEnhancedCallback: EnhancedCallbackHook; export default useEnhancedCallback;