Skip to content
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

Merged

Conversation

flarnie
Copy link
Contributor

@flarnie flarnie commented May 25, 2017

This might be the last PR to land for 15.6RC! 💫

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:
#9398

@flarnie flarnie added this to the 15.6 milestone May 25, 2017
'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 ' +
Copy link
Collaborator

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.

Copy link
Contributor Author

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?

Copy link
Collaborator

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.

Copy link
Contributor Author

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!

@@ -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.' +
Copy link
Collaborator

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".

Copy link
Contributor

@trueadm trueadm left a 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 :)

Copy link
Contributor

@petetnt petetnt left a 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 📝

'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 ' +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small typo: migrate

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!!! Will fix.
nicecatchcat

Copy link
Contributor

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 " +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: migrate

Copy link
Contributor Author

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
@flarnie flarnie force-pushed the improveCreateClassDeprecationWarning branch from 59d2074 to cf5aa32 Compare May 30, 2017 18:39
@flarnie flarnie merged commit 98fde61 into facebook:15.6-dev May 30, 2017
@flarnie flarnie mentioned this pull request May 30, 2017
49 tasks
flarnie added a commit to flarnie/react that referenced this pull request Jun 7, 2017
* 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
@flarnie flarnie deleted the improveCreateClassDeprecationWarning branch May 25, 2018 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants