You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- redoes #15431 from scratch, taking on the feedback there
- unifies the messaging between "deprecated" and UNSAFE_ lifecycle messages. It reorganizes ReactStrictModeWarnings.js to capture and flush all the lifecycle warnings in one procedure each.
- matches the warning from ReactPartialRenderer to match the above change
- passes all the tests
- this also turns on `warnAboutDeprecatedLifecycles` for the test renderer. I think we missed doing so it previously. In a future PR, I'll remove the feature flag altogether.
- this DOES NOT do the same treatment for context warnings, I'll do that in another PR too
'componentWillMount is deprecated and will be removed in the next major version. '+
1407
-
'Use componentDidMount instead. As a temporary workaround, '+
1408
-
'you can rename to UNSAFE_componentWillMount.'+
1409
-
'\n\nPlease update the following components: MyComponent',
1410
-
'componentWillReceiveProps is deprecated and will be removed in the next major version. '+
1411
-
'Use static getDerivedStateFromProps instead.'+
1412
-
'\n\nPlease update the following components: MyComponent',
1413
-
'componentWillUpdate is deprecated and will be removed in the next major version. '+
1414
-
'Use componentDidUpdate instead. As a temporary workaround, '+
1415
-
'you can rename to UNSAFE_componentWillUpdate.'+
1416
-
'\n\nPlease update the following components: MyComponent',
1412
+
/* eslint-disable max-len */
1413
+
`Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-async-component-lifecycle-hooks for details.
1414
+
1415
+
* Move code from componentWillMount to componentDidMount (preferred in most cases) or the constructor.
1416
+
* Rename componentWillMount to UNSAFE_componentWillMount to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work.
1417
+
* To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles /path/to/code\`.
1418
+
1419
+
Please update the following components: MyComponent`,
1420
+
`Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-async-component-lifecycle-hooks for details.
1421
+
1422
+
* Move data fetching code or side effects from componentWillReceiveProps to componentDidUpdate.
1423
+
* If you're updating state whenever props change, refactor your code to use memoization techniques, or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state
1424
+
* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work.
1425
+
* To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles /path/to/code\`.
1426
+
1427
+
Please update the following components: MyComponent`,
1428
+
`Warning: componentWillUpdate has been renamed, and is not recommended for use. See https://fb.me/react-async-component-lifecycle-hooks for details.
1429
+
1430
+
* Move data fetching code or side effects from componentWillUpdate to componentDidUpdate.
1431
+
* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work.
1432
+
* To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles /path/to/code\`.
1433
+
1434
+
Please update the following components: MyComponent`,
0 commit comments