From 521ee26e00c5b3f47f61b4be21769c3a697ec7ba Mon Sep 17 00:00:00 2001 From: Meet Zaveri Date: Wed, 16 Jan 2019 12:53:54 +0530 Subject: [PATCH 1/3] Update README.md --- react/README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/react/README.md b/react/README.md index 542aa1fd7d..fc993ea6bc 100644 --- a/react/README.md +++ b/react/README.md @@ -626,11 +626,8 @@ We don’t recommend using indexes for keys if the order of items may change. 1. optional `static` methods 1. `constructor` 1. `getChildContext` - 1. `componentWillMount` 1. `componentDidMount` - 1. `componentWillReceiveProps` 1. `shouldComponentUpdate` - 1. `componentWillUpdate` 1. `componentDidUpdate` 1. `componentWillUnmount` 1. *clickHandlers or eventHandlers* like `onClickSubmit()` or `onChangeDescription()` @@ -682,11 +679,8 @@ We don’t recommend using indexes for keys if the order of items may change. 1. `getDefaultProps` 1. `getInitialState` 1. `getChildContext` - 1. `componentWillMount` 1. `componentDidMount` - 1. `componentWillReceiveProps` 1. `shouldComponentUpdate` - 1. `componentWillUpdate` 1. `componentDidUpdate` 1. `componentWillUnmount` 1. *clickHandlers or eventHandlers* like `onClickSubmit()` or `onChangeDescription()` From e5a81710a33976899f289e7d044ee792b9373ecb Mon Sep 17 00:00:00 2001 From: Meet Zaveri Date: Sat, 19 Jan 2019 09:14:32 +0530 Subject: [PATCH 2/3] Update README.md --- react/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/react/README.md b/react/README.md index fc993ea6bc..7becd5bd06 100644 --- a/react/README.md +++ b/react/README.md @@ -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 @@ -695,6 +696,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. + +These Component lifecycles are been deprecated since React version 16.3+ : +- componentWillMount +- componentWillReceiveProps +- componentWillUpdate ## Translation From 37fd897b4183e5795e02dc4a2069ddacc85eba5e Mon Sep 17 00:00:00 2001 From: Meet Zaveri Date: Sat, 19 Jan 2019 09:17:19 +0530 Subject: [PATCH 3/3] Undo changes for lifecycle mentions in ordering section --- react/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/react/README.md b/react/README.md index 7becd5bd06..cb1dcd3b83 100644 --- a/react/README.md +++ b/react/README.md @@ -627,8 +627,11 @@ We don’t recommend using indexes for keys if the order of items may change. 1. optional `static` methods 1. `constructor` 1. `getChildContext` + 1. `componentWillMount` 1. `componentDidMount` + 1. `componentWillReceiveProps` 1. `shouldComponentUpdate` + 1. `componentWillUpdate` 1. `componentDidUpdate` 1. `componentWillUnmount` 1. *clickHandlers or eventHandlers* like `onClickSubmit()` or `onChangeDescription()` @@ -680,8 +683,11 @@ We don’t recommend using indexes for keys if the order of items may change. 1. `getDefaultProps` 1. `getInitialState` 1. `getChildContext` + 1. `componentWillMount` 1. `componentDidMount` + 1. `componentWillReceiveProps` 1. `shouldComponentUpdate` + 1. `componentWillUpdate` 1. `componentDidUpdate` 1. `componentWillUnmount` 1. *clickHandlers or eventHandlers* like `onClickSubmit()` or `onChangeDescription()`