MCPcopy Create free account
hub / github.com/react-component/select / useRefFunc

Function useRefFunc

src/hooks/useRefFunc.ts:7–16  ·  view source on GitHub ↗
(callback: T)

Source from the content-addressed store, hash-verified

5 * but redirect to real function.
6 */
7export default function useRefFunc<T extends (...args: any[]) => any>(callback: T): T {
8 const funcRef = React.useRef<T>();
9 funcRef.current = callback;
10
11 const cacheFn = React.useCallback((...args: any[]) => {
12 return funcRef.current(...args);
13 }, []);
14
15 return cacheFn as any;
16}

Callers 1

Select.tsxFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…