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

Function updateFunctionalComponent

code/styling/public/app.js:9825–9856  ·  view source on GitHub ↗
(current, workInProgress)

Source from the content-addressed store, hash-verified

9823 }
9824
9825 function updateFunctionalComponent(current, workInProgress) {
9826 var fn = workInProgress.type;
9827 var nextProps = workInProgress.pendingProps;
9828
9829 if (hasLegacyContextChanged()) {
9830 // Normally we can bail out on props equality but if context has changed
9831 // we don't do the bailout and we have to reuse existing props instead.
9832 } else {
9833 if (workInProgress.memoizedProps === nextProps) {
9834 return bailoutOnAlreadyFinishedWork(current, workInProgress);
9835 }
9836 // TODO: consider bringing fn.shouldComponentUpdate() back.
9837 // It used to be here.
9838 }
9839
9840 var unmaskedContext = getUnmaskedContext(workInProgress);
9841 var context = getMaskedContext(workInProgress, unmaskedContext);
9842
9843 var nextChildren = void 0;
9844
9845 {
9846 ReactCurrentOwner.current = workInProgress;
9847 ReactDebugCurrentFiber.setCurrentPhase('render');
9848 nextChildren = fn(nextProps, context);
9849 ReactDebugCurrentFiber.setCurrentPhase(null);
9850 }
9851 // React DevTools reads this flag.
9852 workInProgress.effectTag |= PerformedWork;
9853 reconcileChildren(current, workInProgress, nextChildren);
9854 memoizeProps(workInProgress, nextProps);
9855 return workInProgress.child;
9856 }
9857
9858 function updateClassComponent(current, workInProgress, renderExpirationTime) {
9859 // 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