diff --git a/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js b/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js index 216afa8550d..cd2d27070fb 100644 --- a/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js +++ b/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js @@ -425,10 +425,9 @@ describe('ReactCompositeComponent', () => { expect(() => { instance = ReactDOM.render(, container); }).toWarnDev( - 'Cannot update during an existing state transition (such as within ' + - "`render` or another component's constructor). Render methods should " + - 'be a pure function of props and state; constructor side-effects are ' + - 'an anti-pattern, but can be moved to `componentWillMount`.', + 'Cannot update the state during an existing state transition. ' + + 'Render methods should be a pure function of props and state. ' + + 'Either assign the initial state in constructor, or move the setState call to componentDidMount', ); // The setState call is queued and then executed as a second pass. This diff --git a/packages/react-dom/src/__tests__/ReactUpdates-test.js b/packages/react-dom/src/__tests__/ReactUpdates-test.js index ecf5c346710..18df0e55bd9 100644 --- a/packages/react-dom/src/__tests__/ReactUpdates-test.js +++ b/packages/react-dom/src/__tests__/ReactUpdates-test.js @@ -1225,7 +1225,9 @@ describe('ReactUpdates', () => { const container = document.createElement('div'); expect(() => ReactDOM.render(, container)).toWarnDev( - 'Cannot update during an existing state transition', + 'Cannot update the state during an existing state transition. ' + + 'Render methods should be a pure function of props and state. ' + + 'Either assign the initial state in constructor, or move the setState call to componentDidMount', ); expect(ops).toEqual(['base: 0, memoized: 0', 'base: 1, memoized: 1']); }); diff --git a/packages/react-reconciler/src/ReactFiberScheduler.js b/packages/react-reconciler/src/ReactFiberScheduler.js index dbd252a20e0..80d602e7afc 100644 --- a/packages/react-reconciler/src/ReactFiberScheduler.js +++ b/packages/react-reconciler/src/ReactFiberScheduler.js @@ -198,10 +198,9 @@ if (__DEV__) { } warning( false, - 'Cannot update during an existing state transition (such as within ' + - "`render` or another component's constructor). Render methods should " + - 'be a pure function of props and state; constructor side-effects are ' + - 'an anti-pattern, but can be moved to `componentWillMount`.', + 'Cannot update the state during an existing state transition. ' + + 'Render methods should be a pure function of props and state. ' + + 'Either assign the initial state in constructor, or move the setState call to componentDidMount', ); didWarnAboutStateTransition = true; break;