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

Function callComponentWillReceiveProps

code/third-party/public/app.js:7698–7719  ·  view source on GitHub ↗
(workInProgress, instance, newProps, newContext)

Source from the content-addressed store, hash-verified

7696 }
7697
7698 function callComponentWillReceiveProps(workInProgress, instance, newProps, newContext) {
7699 var oldState = instance.state;
7700 startPhaseTimer(workInProgress, 'componentWillReceiveProps');
7701 if (typeof instance.componentWillReceiveProps === 'function') {
7702 instance.componentWillReceiveProps(newProps, newContext);
7703 }
7704 if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
7705 instance.UNSAFE_componentWillReceiveProps(newProps, newContext);
7706 }
7707 stopPhaseTimer();
7708
7709 if (instance.state !== oldState) {
7710 {
7711 var componentName = getComponentName(workInProgress) || 'Component';
7712 if (!didWarnAboutStateAssignmentForComponent[componentName]) {
7713 warning(false, '%s.componentWillReceiveProps(): Assigning directly to ' + "this.state is deprecated (except inside a component's " + 'constructor). Use setState instead.', componentName);
7714 didWarnAboutStateAssignmentForComponent[componentName] = true;
7715 }
7716 }
7717 updater.enqueueReplaceState(instance, instance.state, null);
7718 }
7719 }
7720
7721 function callGetDerivedStateFromProps(workInProgress, instance, nextProps, prevState) {
7722 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