Skip to content

Commit cc89cf5

Browse files
committed
Improve deprecation warnings by more info and links (facebook#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:** facebook#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
1 parent 3911544 commit cc89cf5

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/isomorphic/React.js

+14-6
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,10 @@ if (__DEV__) {
5959
createMixin = function(mixin) {
6060
lowPriorityWarning(
6161
warnedForCreateMixin,
62-
'React.createMixin is deprecated and should not be used. You ' +
63-
'can use this mixin directly instead.',
62+
'React.createMixin is deprecated and should not be used. ' +
63+
'In React v16.0, it will be removed. ' +
64+
'You can use this mixin directly instead. ' +
65+
'See https://fb.me/createmixin-was-never-implemented for more info.',
6466
);
6567
warnedForCreateMixin = true;
6668
return mixin;
@@ -109,8 +111,12 @@ if (__DEV__) {
109111
get() {
110112
lowPriorityWarning(
111113
didWarnPropTypesDeprecated,
112-
'Accessing PropTypes via the main React package is deprecated. Use ' +
113-
'the prop-types package from npm instead.',
114+
'Accessing PropTypes via the main React package is deprecated,' +
115+
' and will be removed in React v16.0.' +
116+
' Use the prop-types package from npm instead.' +
117+
' Version 15.5.10 provides a drop-in replacement.' +
118+
' For info on usage, compatibility, migration and more, see ' +
119+
'https://fb.me/prop-types-docs',
114120
);
115121
didWarnPropTypesDeprecated = true;
116122
return ReactPropTypes;
@@ -129,8 +135,10 @@ if (__DEV__) {
129135
lowPriorityWarning(
130136
false,
131137
'Accessing factories like React.DOM.%s has been deprecated ' +
132-
'and will be removed in the future. Use the ' +
133-
'react-addons-dom-factories package instead.',
138+
'and will be removed in v16.0+. Use the ' +
139+
'react-addons-dom-factories package instead. ' +
140+
' Version 1.0 provides a drop-in replacement.' +
141+
' For more info, see https://fb.me/react-addons-dom-factories',
134142
factory,
135143
);
136144
warnedForFactories = true;

0 commit comments

Comments
 (0)