MCPcopy
hub / github.com/facebook/react / useRef

Function useRef

packages/react-debug-tools/src/ReactDebugHooks.js:325–337  ·  view source on GitHub ↗
(initialValue: T)

Source from the content-addressed store, hash-verified

323}
324
325function useRef<T>(initialValue: T): {current: T} {
326 const hook = nextHook();
327 const ref = hook !== null ? hook.memoizedState : {current: initialValue};
328 hookLog.push({
329 displayName: null,
330 primitive: 'Ref',
331 stackError: new Error(),
332 value: ref.current,
333 debugInfo: null,
334 dispatcherHookName: 'Ref',
335 });
336 return ref;
337}
338
339function useCacheRefresh(): () => void {
340 const hook = nextHook();

Callers 15

EffectWithStateFunction · 0.90
index.jsFile · 0.90
WarnOnUpdateFunction · 0.90
ErrorOnUpdateFunction · 0.90
ErrorAndWarningOnUpdateFunction · 0.90
ListApp.jsFile · 0.90
Timeline.jsFile · 0.90
CanvasPage.jsFile · 0.90
useSmartTooltipFunction · 0.90
useCanvasInteractionFunction · 0.90
ModalDialog.jsFile · 0.90

Calls 2

nextHookFunction · 0.85
pushMethod · 0.65

Tested by 2

AppFunction · 0.40
CounterFunction · 0.40