Recompose's onlyUpdateForKeys and react/require-optimization.
See original GitHub issueI was wondering if this rule still make sense if I use recompose’s onlyUpdateForKeys
(https://github.com/acdlite/recompose/blob/master/docs/API.md#onlyupdateforkeys):
Prevents the component from updating unless a prop corresponding to one of the given keys has updated. Uses shallowEqual() to test for changes.
This is a much better optimization than the popular approach of using PureRenderMixin, shouldPureComponentUpdate(), or Recompose’s own pure() helper, because those tools compare every prop, whereas onlyUpdateForKeys() only cares about the props that you specify.
The rule is this (https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-optimization.md):
Component is not optimized. Please add a shouldComponentUpdate method. (react/require-optimization)
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (4 by maintainers)
I’m using
plugin:react/all
in my.eslintrc
. This is the reason. 😄The rule won’t be removed - there’s no need to RFC anything.