MCPcopy Index your code
hub / github.com/krasimir/react-in-patterns / updateFunctionalComponent

Function updateFunctionalComponent

code/new-context-api/public/app.js:9186–9217  ·  view source on GitHub ↗
(current, workInProgress)

Source from the content-addressed store, hash-verified

9184 }
9185
9186 function updateFunctionalComponent(current, workInProgress) {
9187 var fn = workInProgress.type;
9188 var nextProps = workInProgress.pendingProps;
9189
9190 if (hasLegacyContextChanged()) {
9191 // Normally we can bail out on props equality but if context has changed
9192 // we don't do the bailout and we have to reuse existing props instead.
9193 } else {
9194 if (workInProgress.memoizedProps === nextProps) {
9195 return bailoutOnAlreadyFinishedWork(current, workInProgress);
9196 }
9197 // TODO: consider bringing fn.shouldComponentUpdate() back.
9198 // It used to be here.
9199 }
9200
9201 var unmaskedContext = getUnmaskedContext(workInProgress);
9202 var context = getMaskedContext(workInProgress, unmaskedContext);
9203
9204 var nextChildren = void 0;
9205
9206 {
9207 ReactCurrentOwner.current = workInProgress;
9208 ReactDebugCurrentFiber.setCurrentPhase('render');
9209 nextChildren = fn(nextProps, context);
9210 ReactDebugCurrentFiber.setCurrentPhase(null);
9211 }
9212 // React DevTools reads this flag.
9213 workInProgress.effectTag |= PerformedWork;
9214 reconcileChildren(current, workInProgress, nextChildren);
9215 memoizeProps(workInProgress, nextProps);
9216 return workInProgress.child;
9217 }
9218
9219 function updateClassComponent(current, workInProgress, renderExpirationTime) {
9220 // 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