question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Recompose's onlyUpdateForKeys and react/require-optimization.

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ghostcommented, Jul 8, 2018

I’m using plugin:react/all in my .eslintrc. This is the reason. 😄

0reactions
ljharbcommented, Jul 3, 2018

The rule won’t be removed - there’s no need to RFC anything.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Recompose's onlyUpdateForKeys and react/require ... - GitHub
I was wondering if this rule still make sense if I use recompose's onlyUpdateForKeys (https://github.com/acdlite/recompose/blob/master/docs/API.
Read more >
Tips to replace Recompose's HOCs with React Hooks for ...
Recently I worked on refactoring its codebase, replacing Recompose with React Hooks. I would like to share my tips I found while working...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found