You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As per the docs here, if you pass a selector callback that returns a new object to useSelector() (e.g. useSelector(state => ({prop: state.someReducer.prop})), then the component will re-render on any state change in the entire store. Thus the docs suggest that you pass an equalityFn as the 2nd parameter to useSelector(); typically shallowEqual that is shipped with react-redux.
It would be cool if the eslint plugin provided a way to enforce this. My colleagues wrote a bunch of useSelector() calls with selectors returning new callbacks, without passing a 2nd argument (shallowEqual).
luin, shubhamdehaat, derekmt12, EvgenyOrekhov, metapink and 2 more