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

Function callGetDerivedStateFromProps

code/third-party/public/app.js:7721–7745  ·  view source on GitHub ↗
(workInProgress, instance, nextProps, prevState)

Source from the content-addressed store, hash-verified

7719 }
7720
7721 function callGetDerivedStateFromProps(workInProgress, instance, nextProps, prevState) {
7722 var type = workInProgress.type;
7723
7724
7725 if (typeof type.getDerivedStateFromProps === 'function') {
7726 if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
7727 // Invoke method an extra time to help detect side-effects.
7728 type.getDerivedStateFromProps.call(null, nextProps, prevState);
7729 }
7730
7731 var partialState = type.getDerivedStateFromProps.call(null, nextProps, prevState);
7732
7733 {
7734 if (partialState === undefined) {
7735 var componentName = getComponentName(workInProgress) || 'Component';
7736 if (!didWarnAboutUndefinedDerivedState[componentName]) {
7737 warning(false, '%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', componentName);
7738 didWarnAboutUndefinedDerivedState[componentName] = componentName;
7739 }
7740 }
7741 }
7742
7743 return partialState;
7744 }
7745 }
7746
7747 // Invokes the mount life-cycles on a previously never rendered instance.
7748 function mountClassInstance(workInProgress, renderExpirationTime) {

Callers 4

constructClassInstanceFunction · 0.70
resumeMountClassInstanceFunction · 0.70
updateClassInstanceFunction · 0.70

Calls 2

warningFunction · 0.85
getComponentNameFunction · 0.70

Tested by

no test coverage detected