@@ -239,11 +239,9 @@ describe('ReactCompositeComponent', () => {
239239 const container = document . createElement ( 'div' ) ;
240240 expect ( ( ) => ReactDOM . render ( < MyComponent /> , container ) ) . toWarnDev (
241241 "Warning: Can't call forceUpdate on a component that is not yet mounted. " +
242- 'This is a no-op, but it might indicate a bug in your application.\n\n' +
243- 'To fix, assign the initial state in the MyComponent constructor. ' +
244- 'If the state needs to reflect an external data source, ' +
245- 'you may also add a componentDidMount lifecycle hook to MyComponent ' +
246- 'and call setState there if the external data has changed.' ,
242+ 'This is a no-op, but it might indicate a bug in your application. ' +
243+ 'Instead, assign to `this.state` directly or define a `state = {};` ' +
244+ 'class property with the desired state in the MyComponent component.' ,
247245 ) ;
248246
249247 // No additional warning should be recorded
@@ -265,11 +263,9 @@ describe('ReactCompositeComponent', () => {
265263 const container = document . createElement ( 'div' ) ;
266264 expect ( ( ) => ReactDOM . render ( < MyComponent /> , container ) ) . toWarnDev (
267265 "Warning: Can't call setState on a component that is not yet mounted. " +
268- 'This is a no-op, but it might indicate a bug in your application.\n\n' +
269- 'To fix, assign the initial state in the MyComponent constructor. ' +
270- 'If the state needs to reflect an external data source, ' +
271- 'you may also add a componentDidMount lifecycle hook to MyComponent ' +
272- 'and call setState there if the external data has changed.' ,
266+ 'This is a no-op, but it might indicate a bug in your application. ' +
267+ 'Instead, assign to `this.state` directly or define a `state = {};` ' +
268+ 'class property with the desired state in the MyComponent component.' ,
273269 ) ;
274270
275271 // No additional warning should be recorded
0 commit comments