MCPcopy Create free account
hub / github.com/microsoft/SandDance / updateMemo

Function updateMemo

docs/external/js/react-dom.development.js:15582–15601  ·  view source on GitHub ↗
(nextCreate, deps)

Source from the content-addressed store, hash-verified

15580 }
15581
15582 function updateMemo(nextCreate, deps) {
15583 var hook = updateWorkInProgressHook();
15584 var nextDeps = deps === undefined ? null : deps;
15585 var prevState = hook.memoizedState;
15586
15587 if (prevState !== null) {
15588 // Assume these are defined. If they're not, areHookInputsEqual will warn.
15589 if (nextDeps !== null) {
15590 var prevDeps = prevState[1];
15591
15592 if (areHookInputsEqual(nextDeps, prevDeps)) {
15593 return prevState[0];
15594 }
15595 }
15596 }
15597
15598 var nextValue = nextCreate();
15599 hook.memoizedState = [nextValue, nextDeps];
15600 return nextValue;
15601 }
15602
15603 function mountDeferredValue(value, config) {
15604 var _mountState = mountState(value),

Callers 1

Calls 2

updateWorkInProgressHookFunction · 0.85
areHookInputsEqualFunction · 0.85

Tested by

no test coverage detected