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

Function updateFunctionalComponent

code/event-handlers/public/app.js:9155–9186  ·  view source on GitHub ↗
(current, workInProgress)

Source from the content-addressed store, hash-verified

9153 }
9154
9155 function updateFunctionalComponent(current, workInProgress) {
9156 var fn = workInProgress.type;
9157 var nextProps = workInProgress.pendingProps;
9158
9159 if (hasLegacyContextChanged()) {
9160 // Normally we can bail out on props equality but if context has changed
9161 // we don't do the bailout and we have to reuse existing props instead.
9162 } else {
9163 if (workInProgress.memoizedProps === nextProps) {
9164 return bailoutOnAlreadyFinishedWork(current, workInProgress);
9165 }
9166 // TODO: consider bringing fn.shouldComponentUpdate() back.
9167 // It used to be here.
9168 }
9169
9170 var unmaskedContext = getUnmaskedContext(workInProgress);
9171 var context = getMaskedContext(workInProgress, unmaskedContext);
9172
9173 var nextChildren = void 0;
9174
9175 {
9176 ReactCurrentOwner.current = workInProgress;
9177 ReactDebugCurrentFiber.setCurrentPhase('render');
9178 nextChildren = fn(nextProps, context);
9179 ReactDebugCurrentFiber.setCurrentPhase(null);
9180 }
9181 // React DevTools reads this flag.
9182 workInProgress.effectTag |= PerformedWork;
9183 reconcileChildren(current, workInProgress, nextChildren);
9184 memoizeProps(workInProgress, nextProps);
9185 return workInProgress.child;
9186 }
9187
9188 function updateClassComponent(current, workInProgress, renderExpirationTime) {
9189 // 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