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