MCPcopy Create free account
hub / github.com/reactjs/react-rails / updateFunctionComponent

Function updateFunctionComponent

lib/assets/react-source/development/react.js:20702–20750  ·  view source on GitHub ↗
(current, workInProgress, Component, nextProps, renderExpirationTime)

Source from the content-addressed store, hash-verified

20700 }
20701
20702 function updateFunctionComponent(current, workInProgress, Component, nextProps, renderExpirationTime) {
20703 {
20704 if (workInProgress.type !== workInProgress.elementType) {
20705 // Lazy component props can't be validated in createElement
20706 // because they're only guaranteed to be resolved here.
20707 var innerPropTypes = Component.propTypes;
20708
20709 if (innerPropTypes) {
20710 checkPropTypes(innerPropTypes, nextProps, // Resolved props
20711 'prop', getComponentName(Component), getCurrentFiberStackInDev);
20712 }
20713 }
20714 }
20715
20716 var context;
20717
20718 {
20719 var unmaskedContext = getUnmaskedContext(workInProgress, Component, true);
20720 context = getMaskedContext(workInProgress, unmaskedContext);
20721 }
20722
20723 var nextChildren;
20724 prepareToReadContext(workInProgress, renderExpirationTime);
20725
20726 {
20727 ReactCurrentOwner$1.current = workInProgress;
20728 setIsRendering(true);
20729 nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderExpirationTime);
20730
20731 if ( workInProgress.mode & StrictMode) {
20732 // Only double-render components with Hooks
20733 if (workInProgress.memoizedState !== null) {
20734 nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderExpirationTime);
20735 }
20736 }
20737
20738 setIsRendering(false);
20739 }
20740
20741 if (current !== null && !didReceiveUpdate) {
20742 bailoutHooks(current, workInProgress, renderExpirationTime);
20743 return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime);
20744 } // React DevTools reads this flag.
20745
20746
20747 workInProgress.effectTag |= PerformedWork;
20748 reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime);
20749 return workInProgress.child;
20750 }
20751
20752 function updateClassComponent(current, workInProgress, Component, nextProps, renderExpirationTime) {
20753 {

Callers 3

mountLazyComponentFunction · 0.85
beginWorkFunction · 0.85

Calls 10

getUnmaskedContextFunction · 0.85
getMaskedContextFunction · 0.85
prepareToReadContextFunction · 0.85
setIsRenderingFunction · 0.85
renderWithHooksFunction · 0.85
bailoutHooksFunction · 0.85
reconcileChildrenFunction · 0.85
checkPropTypesFunction · 0.70
getComponentNameFunction · 0.70

Tested by

no test coverage detected