MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / updateFunctionalComponent

Function updateFunctionalComponent

code/third-party/public/app.js:9058–9089  ·  view source on GitHub ↗
(current, workInProgress)

Source from the content-addressed store, hash-verified

9056 }
9057
9058 function updateFunctionalComponent(current, workInProgress) {
9059 var fn = workInProgress.type;
9060 var nextProps = workInProgress.pendingProps;
9061
9062 if (hasLegacyContextChanged()) {
9063 // Normally we can bail out on props equality but if context has changed
9064 // we don't do the bailout and we have to reuse existing props instead.
9065 } else {
9066 if (workInProgress.memoizedProps === nextProps) {
9067 return bailoutOnAlreadyFinishedWork(current, workInProgress);
9068 }
9069 // TODO: consider bringing fn.shouldComponentUpdate() back.
9070 // It used to be here.
9071 }
9072
9073 var unmaskedContext = getUnmaskedContext(workInProgress);
9074 var context = getMaskedContext(workInProgress, unmaskedContext);
9075
9076 var nextChildren = void 0;
9077
9078 {
9079 ReactCurrentOwner.current = workInProgress;
9080 ReactDebugCurrentFiber.setCurrentPhase('render');
9081 nextChildren = fn(nextProps, context);
9082 ReactDebugCurrentFiber.setCurrentPhase(null);
9083 }
9084 // React DevTools reads this flag.
9085 workInProgress.effectTag |= PerformedWork;
9086 reconcileChildren(current, workInProgress, nextChildren);
9087 memoizeProps(workInProgress, nextProps);
9088 return workInProgress.child;
9089 }
9090
9091 function updateClassComponent(current, workInProgress, renderExpirationTime) {
9092 // Push context providers early to prevent context stack mismatches.

Callers 1

beginWorkFunction · 0.70

Calls 5

getUnmaskedContextFunction · 0.70
getMaskedContextFunction · 0.70
reconcileChildrenFunction · 0.70
memoizePropsFunction · 0.70

Tested by

no test coverage detected