1 | import * as React from 'react';
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | export default function useMemoCallback(func) {
|
8 | var funRef = React.useRef(func);
|
9 | funRef.current = func;
|
10 | var callback = React.useCallback(function () {
|
11 | var _funRef$current;
|
12 |
|
13 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
14 | args[_key] = arguments[_key];
|
15 | }
|
16 |
|
17 | return (_funRef$current = funRef.current) === null || _funRef$current === void 0 ? void 0 : _funRef$current.call.apply(_funRef$current, [funRef].concat(args));
|
18 | }, []);
|
19 | return func ? callback : undefined;
|
20 | } |
\ | No newline at end of file |