facebookarchive / redux-react-hook

React Hook for accessing state and dispatch from a Redux store
MIT License
2.16k stars 103 forks source link

Custom equalityCheck function #76

Closed ianobermiller closed 4 years ago

ianobermiller commented 4 years ago

Per #74, I propose we release a new major version of redux-react-hook in which you pass in your own equality comparator. That way you won't be tied to a particular comparison implementation.

The motivation for this change is that returning an ES6 Map directly from mapState would cause shallowEqual to return true, and then the component won't re-render, even if the map instance has. After this change, your comparison function can either handle Map and Set by reference, or perform a shallow comparison on the values.