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

Function callComponentWillReceiveProps

code/styling/public/app.js:8465–8486  ·  view source on GitHub ↗
(workInProgress, instance, newProps, newContext)

Source from the content-addressed store, hash-verified

8463 }
8464
8465 function callComponentWillReceiveProps(workInProgress, instance, newProps, newContext) {
8466 var oldState = instance.state;
8467 startPhaseTimer(workInProgress, 'componentWillReceiveProps');
8468 if (typeof instance.componentWillReceiveProps === 'function') {
8469 instance.componentWillReceiveProps(newProps, newContext);
8470 }
8471 if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
8472 instance.UNSAFE_componentWillReceiveProps(newProps, newContext);
8473 }
8474 stopPhaseTimer();
8475
8476 if (instance.state !== oldState) {
8477 {
8478 var componentName = getComponentName(workInProgress) || 'Component';
8479 if (!didWarnAboutStateAssignmentForComponent[componentName]) {
8480 warning(false, '%s.componentWillReceiveProps(): Assigning directly to ' + "this.state is deprecated (except inside a component's " + 'constructor). Use setState instead.', componentName);
8481 didWarnAboutStateAssignmentForComponent[componentName] = true;
8482 }
8483 }
8484 updater.enqueueReplaceState(instance, instance.state, null);
8485 }
8486 }
8487
8488 function callGetDerivedStateFromProps(workInProgress, instance, nextProps, prevState) {
8489 var type = workInProgress.type;

Callers 2

resumeMountClassInstanceFunction · 0.70
updateClassInstanceFunction · 0.70

Calls 5

warningFunction · 0.85
startPhaseTimerFunction · 0.70
stopPhaseTimerFunction · 0.70
getComponentNameFunction · 0.70

Tested by

no test coverage detected