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

Function callGetDerivedStateFromProps

code/redux/public/app.js:8739–8763  ·  view source on GitHub ↗
(workInProgress, instance, nextProps, prevState)

Source from the content-addressed store, hash-verified

8737 }
8738
8739 function callGetDerivedStateFromProps(workInProgress, instance, nextProps, prevState) {
8740 var type = workInProgress.type;
8741
8742
8743 if (typeof type.getDerivedStateFromProps === 'function') {
8744 if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
8745 // Invoke method an extra time to help detect side-effects.
8746 type.getDerivedStateFromProps.call(null, nextProps, prevState);
8747 }
8748
8749 var partialState = type.getDerivedStateFromProps.call(null, nextProps, prevState);
8750
8751 {
8752 if (partialState === undefined) {
8753 var componentName = getComponentName(workInProgress) || 'Component';
8754 if (!didWarnAboutUndefinedDerivedState[componentName]) {
8755 warning(false, '%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', componentName);
8756 didWarnAboutUndefinedDerivedState[componentName] = componentName;
8757 }
8758 }
8759 }
8760
8761 return partialState;
8762 }
8763 }
8764
8765 // Invokes the mount life-cycles on a previously never rendered instance.
8766 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