(workInProgress, instance, newProps, newContext)
| 8714 | } |
| 8715 | |
| 8716 | function callComponentWillReceiveProps(workInProgress, instance, newProps, newContext) { |
| 8717 | var oldState = instance.state; |
| 8718 | startPhaseTimer(workInProgress, 'componentWillReceiveProps'); |
| 8719 | if (typeof instance.componentWillReceiveProps === 'function') { |
| 8720 | instance.componentWillReceiveProps(newProps, newContext); |
| 8721 | } |
| 8722 | if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') { |
| 8723 | instance.UNSAFE_componentWillReceiveProps(newProps, newContext); |
| 8724 | } |
| 8725 | stopPhaseTimer(); |
| 8726 | |
| 8727 | if (instance.state !== oldState) { |
| 8728 | { |
| 8729 | var componentName = getComponentName(workInProgress) || 'Component'; |
| 8730 | if (!didWarnAboutStateAssignmentForComponent[componentName]) { |
| 8731 | warning(false, '%s.componentWillReceiveProps(): Assigning directly to ' + "this.state is deprecated (except inside a component's " + 'constructor). Use setState instead.', componentName); |
| 8732 | didWarnAboutStateAssignmentForComponent[componentName] = true; |
| 8733 | } |
| 8734 | } |
| 8735 | updater.enqueueReplaceState(instance, instance.state, null); |
| 8736 | } |
| 8737 | } |
| 8738 | |
| 8739 | function callGetDerivedStateFromProps(workInProgress, instance, nextProps, prevState) { |
| 8740 | var type = workInProgress.type; |
no test coverage detected