UNPKG

276 BJavaScriptView Raw
1import { useCallback } from 'react';
2import useCommittedRef from './useCommittedRef';
3export default function useEventCallback(fn) {
4 var ref = useCommittedRef(fn);
5 return useCallback(function () {
6 return ref.current && ref.current.apply(ref, arguments);
7 }, [ref]);
8}
\No newline at end of file