-
Notifications
You must be signed in to change notification settings - Fork 26.8k
[guide] [react] add note about deprecated lifecycles #1993
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ This style guide is mostly based on the standards that are currently prevalent i | |
1. [Methods](#methods) | ||
1. [Ordering](#ordering) | ||
1. [`isMounted`](#ismounted) | ||
1. [Things to avoid](#thingstoavoid) | ||
|
||
## Basic Rules | ||
|
||
|
@@ -701,6 +702,15 @@ We don’t recommend using indexes for keys if the order of items may change. | |
> Why? [`isMounted` is an anti-pattern][anti-pattern], is not available when using ES6 classes, and is on its way to being officially deprecated. | ||
|
||
[anti-pattern]: https://facebook.github.io/react/blog/2015/12/16/ismounted-antipattern.html | ||
|
||
## Things to avoid | ||
|
||
Using deprecated APIs will create bad legacy code. Hence it's good to know that which APIs have been deprecated. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All of these APIs are not "bad" or "legacy", they're solely not safe to use with async rendering. Can you rephrase this to have less of a judgemental connotation? |
||
|
||
These Component lifecycles are been deprecated since React version 16.3+ : | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we add, for each one, which methods should be used instead (with links to their documentation)? |
||
- componentWillMount | ||
- componentWillReceiveProps | ||
- componentWillUpdate | ||
|
||
## Translation | ||
|
||
|
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.
This isn't the right phrasing here; someone using React 16.2 shouldn't be avoiding anything.