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

Function useMemo

packages/react-debug-tools/src/ReactDebugHooks.js:445–460  ·  view source on GitHub ↗
(
  nextCreate: () => T,
  inputs: Array<mixed> | void | null,
)

Source from the content-addressed store, hash-verified

443}
444
445function useMemo<T>(
446 nextCreate: () => T,
447 inputs: Array<mixed> | void | null,
448): T {
449 const hook = nextHook();
450 const value = hook !== null ? hook.memoizedState[0] : nextCreate();
451 hookLog.push({
452 displayName: null,
453 primitive: 'Memo',
454 stackError: new Error(),
455 value,
456 debugInfo: null,
457 dispatcherHookName: 'Memo',
458 });
459 return value;
460}
461
462function useSyncExternalStore<T>(
463 subscribe: (() => void) => () => void,

Callers 15

CanvasPageContextMenuFunction · 0.90
useThemeStylesFunction · 0.90
DevTools.jsFile · 0.90
Tree.jsFile · 0.90
Element.jsFile · 0.90
TreeContextControllerFunction · 0.90
KeyValueFunction · 0.90
index.jsFile · 0.90

Calls 2

nextHookFunction · 0.85
pushMethod · 0.65

Tested by 15

ComponentFunction · 0.40
ComponentFunction · 0.40
Component$4Function · 0.40
ComponentFunction · 0.40
ComponentFunction · 0.40
ComponentFunction · 0.40
ComponentFunction · 0.40
ComponentFunction · 0.40
ComponentFunction · 0.40
ComponentFunction · 0.40
ComponentFunction · 0.40
ComponentFunction · 0.40