mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Improve deprecation warnings by more info and links (#9768)
* Improve deprecation warnings by more info and links **what is the change?:** Updates the warnings for - - `React.createMixin` (was never implemented!) - `React.PropTypes` - `React.createClass` - `React.DOM.*` We never added the warning for `React.createClass` to the 15.5 line, so a follow-up PR will add that, with a link to docs etc. Does *not* update the older warnings for - - Factory.type - 'isMounted' and 'replaceState' - ReactPerf We could do a second pass if we want to improve those three warnings, but for now I don't think they are as hi-pri. Still TODO: - Do an initial release of the [`react-addons-dom-factories`](https://github.com/facebook/react/tree/master/packages/react-dom-factories#react-addons-dom-factories) package on npm, making it 1.0. - Improve the docs for `react-addons-dom-factories` adding documentation and mention the [codemod](https://github.com/reactjs/react-codemod/blob/master/transforms/React-DOM-to-react-dom-factories.js) **why make this change?:** - We want to make updating as easy as possible. Warning messages should increase clarity, and in the past they have caused confusion. **test plan:** `yarn test` and running these messages past some folks who use React. **issue:** https://github.com/facebook/react/issues/9398 * Rephrase deprecation messages for clarity **what is the change?:** We rephrased the deprecation messages to clarify that - these APIs are currently deprecated - they will be removed in React v16.0 The previous wording implied that they would be deprecated in v16.0. **why make this change?:** To make the messages easier to understand. **test plan:** Visual inspection
This commit is contained in:
+14
-6
@@ -59,8 +59,10 @@ if (__DEV__) {
|
||||
createMixin = function(mixin) {
|
||||
lowPriorityWarning(
|
||||
warnedForCreateMixin,
|
||||
'React.createMixin is deprecated and should not be used. You ' +
|
||||
'can use this mixin directly instead.',
|
||||
'React.createMixin is deprecated and should not be used. ' +
|
||||
'In React v16.0, it will be removed. ' +
|
||||
'You can use this mixin directly instead. ' +
|
||||
'See https://fb.me/createmixin-was-never-implemented for more info.',
|
||||
);
|
||||
warnedForCreateMixin = true;
|
||||
return mixin;
|
||||
@@ -109,8 +111,12 @@ if (__DEV__) {
|
||||
get() {
|
||||
lowPriorityWarning(
|
||||
didWarnPropTypesDeprecated,
|
||||
'Accessing PropTypes via the main React package is deprecated. Use ' +
|
||||
'the prop-types package from npm instead.',
|
||||
'Accessing PropTypes via the main React package is deprecated,' +
|
||||
' and will be removed in React v16.0.' +
|
||||
' Use the prop-types package from npm instead.' +
|
||||
' Version 15.5.10 provides a drop-in replacement.' +
|
||||
' For info on usage, compatibility, migration and more, see ' +
|
||||
'https://fb.me/prop-types-docs',
|
||||
);
|
||||
didWarnPropTypesDeprecated = true;
|
||||
return ReactPropTypes;
|
||||
@@ -129,8 +135,10 @@ if (__DEV__) {
|
||||
lowPriorityWarning(
|
||||
false,
|
||||
'Accessing factories like React.DOM.%s has been deprecated ' +
|
||||
'and will be removed in the future. Use the ' +
|
||||
'react-addons-dom-factories package instead.',
|
||||
'and will be removed in v16.0+. Use the ' +
|
||||
'react-addons-dom-factories package instead. ' +
|
||||
' Version 1.0 provides a drop-in replacement.' +
|
||||
' For more info, see https://fb.me/react-addons-dom-factories',
|
||||
factory,
|
||||
);
|
||||
warnedForFactories = true;
|
||||
|
||||
Reference in New Issue
Block a user