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

Function useRef

packages/react-server/src/ReactFizzHooks.js:473–488  ·  view source on GitHub ↗
(initialValue: T)

Source from the content-addressed store, hash-verified

471}
472
473function useRef<T>(initialValue: T): {current: T} {
474 currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
475 workInProgressHook = createWorkInProgressHook();
476 const previousRef = workInProgressHook.memoizedState;
477 if (previousRef === null) {
478 const ref = {current: initialValue};
479 if (__DEV__) {
480 Object.seal(ref);
481 }
482 // $FlowFixMe[incompatible-use] found when upgrading Flow
483 workInProgressHook.memoizedState = ref;
484 return ref;
485 } else {
486 return previousRef;
487 }
488}
489
490function dispatchAction<A>(
491 componentIdentity: Object,

Callers

nothing calls this directly

Calls 2

createWorkInProgressHookFunction · 0.85

Tested by

no test coverage detected