-
So I would like to provide an eslint rule that checks the usage of |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I disagree that it is a performance loss. Consider:
this select transformation is a simple object pick. It's fine to run on every render. So as always, "it depends". Adding Comparing to other state managers that have selectors like zustand or redux, there is also no rule that wants you to cache selectors per default:
this is totally fine, and also runs on every state update and render. |
Beta Was this translation helpful? Give feedback.
-
Yes, in most cases select is just some simple picking operations, and in only a few cases it could be much heavier operations, so perhaps we'd better do performance optimization case by case. |
Beta Was this translation helpful? Give feedback.
I disagree that it is a performance loss. Consider:
this select transformation is a simple object pick. It's fine to run on every render. So as always, "it depends". Adding
useCallback
here would likely make things slower, because you would need to memoize and cache a trivial object lookup.Comparing to other state managers that have selectors like zustand or redux,…