@winglet/react-utils
Version:
React utility library providing custom hooks, higher-order components (HOCs), and utility functions to enhance React application development with improved reusability and functionality
14 lines (11 loc) • 373 B
JavaScript
import { useCallback } from 'react';
import { useReference } from './useReference.mjs';
const useHandle = (handler) => {
const handelRef = useReference(handler);
return useCallback((...args) => {
if (typeof handelRef.current === 'function')
return handelRef.current(...args);
return null;
}, [handelRef]);
};
export { useHandle };