Browse Source

Document deepEquality checks & JSON.stringify in scu are a bad idea

main
Carlos Cuesta 8 years ago
parent
commit
1442bf4944
No known key found for this signature in database GPG Key ID: 61C42E9291BDFAFD
  1. 2
      content/docs/reference-react-component.md

2
content/docs/reference-react-component.md

@ -206,6 +206,8 @@ Currently, if `shouldComponentUpdate()` returns `false`, then [`componentWillUpd
If you determine a specific component is slow after profiling, you may change it to inherit from [`React.PureComponent`](/docs/react-api.html#react.purecomponent) which implements `shouldComponentUpdate()` with a shallow prop and state comparison. If you are confident you want to write it by hand, you may compare `this.props` with `nextProps` and `this.state` with `nextState` and return `false` to tell React the update can be skipped.
We do not recommend doing deep equality checks and using `JSON.stringify()` in `shouldComponentUpdate()`. It is very inefficient and a really bad idea for performance.
* * *
### `componentWillUpdate()`

Loading…
Cancel
Save