-
Notifications
You must be signed in to change notification settings - Fork 46.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve warning for React.createClass
#9781
Improve warning for React.createClass
#9781
Conversation
src/isomorphic/React.js
Outdated
'Accessing createClass via the main React package is deprecated,' + | ||
' and will be removed in React v16.0.' + | ||
" Use a plain JavaScript class instead. If you're not yet " + | ||
'ready to migrade, create-react-class v15.5.3 is available ' + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can probably say v15 here because even if we release bugfixes we guarantee it's a drop in replacement anyway. And we want people to install fixes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Were there any issues with versions earlier than 15.3 though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, probably. I just mean that we shouldn't give the impression that 15.5.3 is specific version to try because we know it's already broken (for AMD). We should recommend that they use the latest available 15.x version of create-react-class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point - will fix. Thanks!
src/isomorphic/React.js
Outdated
@@ -112,8 +112,7 @@ if (__DEV__) { | |||
didWarnPropTypesDeprecated, | |||
'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.' + | |||
' Use the latest available 15.* prop-types package from npm instead.' + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use v
consistently in the message — either v15
or we can drop v
from "React v16".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once Dan's comment about the message including "v" is added :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A small typo had snuck in 📝
src/isomorphic/React.js
Outdated
'Accessing createClass via the main React package is deprecated,' + | ||
' and will be removed in React v16.0.' + | ||
" Use a plain JavaScript class instead. If you're not yet " + | ||
'ready to migrade, create-react-class v15.* is available ' + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small typo: migrate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That GIF is awesome 😹 😹
'Warning: Accessing createClass via the main React package is ' + | ||
'deprecated, and will be removed in React v16.0. ' + | ||
'Use a plain JavaScript class instead. ' + | ||
"If you're not yet ready to migrade, create-react-class " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: migrate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double-thanks!
**what is the change?:** - Explain that this will be removed in v16.0 specifically - Mention the version number for the drop-in replacement module. - Link to docs in the blog post about how to migrate **why make this change?:** We want to make our deprecation warnings more clear and helpful. **test plan:** Visual inspection and `yarn test` **issue:** facebook#9398
**what is the change?:** Instead of recommending specific versions of 'prop-types' and 'create-react-class' we ask folks to use the latest available 15.* version. **why make this change?:** The latest version of those plugins, within the 15 version, is the most likely to be stable. For example, we know that 'react-create-class' is broken for AMD builds at the current latest version, so once we release a fix then the recommended version will change. **test plan:** Visual inspection Also fixed some tests.
**what is the change?:** - `migrade` -> `migrate` - `15.* prop-types package` -> `v15.* prop-types package` **why make this change?:** Correctness **test plan:** `yarn test` and visual inspection
59d2074
to
cf5aa32
Compare
* Improve warning for `React.createClass` **what is the change?:** - Explain that this will be removed in v16.0 specifically - Mention the version number for the drop-in replacement module. - Link to docs in the blog post about how to migrate **why make this change?:** We want to make our deprecation warnings more clear and helpful. **test plan:** Visual inspection and `yarn test` **issue:** facebook#9398 * Widen range of recommended replacement module versions **what is the change?:** Instead of recommending specific versions of 'prop-types' and 'create-react-class' we ask folks to use the latest available 15.* version. **why make this change?:** The latest version of those plugins, within the 15 version, is the most likely to be stable. For example, we know that 'react-create-class' is broken for AMD builds at the current latest version, so once we release a fix then the recommended version will change. **test plan:** Visual inspection Also fixed some tests. * Fix typos and things **what is the change?:** - `migrade` -> `migrate` - `15.* prop-types package` -> `v15.* prop-types package` **why make this change?:** Correctness **test plan:** `yarn test` and visual inspection
This might be the last PR to land for 15.6RC! 💫
what is the change?:
why make this change?:
We want to make our deprecation warnings more clear and helpful.
test plan:
Visual inspection and
yarn test
issue:
#9398