@@ -239,11 +239,9 @@ describe('ReactCompositeComponent', () => {
239
239
const container = document . createElement ( 'div' ) ;
240
240
expect ( ( ) => ReactDOM . render ( < MyComponent /> , container ) ) . toWarnDev (
241
241
"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.' ,
247
245
) ;
248
246
249
247
// No additional warning should be recorded
@@ -265,11 +263,9 @@ describe('ReactCompositeComponent', () => {
265
263
const container = document . createElement ( 'div' ) ;
266
264
expect ( ( ) => ReactDOM . render ( < MyComponent /> , container ) ) . toWarnDev (
267
265
"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.' ,
273
269
) ;
274
270
275
271
// No additional warning should be recorded
0 commit comments