This commit is contained in:
Kaan Barmore-Genç 2022-09-18 22:01:21 -04:00
parent 6606e5751d
commit 985777a1e9
Signed by: kaan
GPG key ID: B2E280771CD62FCF

View file

@ -81,7 +81,7 @@ using the `pick` function to extract values out of an object. React Redux checks
if the value selected by the selector has changed to decide if things need to be
re-rendered, but it uses a basic equality comparison and not a deep equality
check. Because `pick` keeps creating new objects, the objects are never equal to
each other, and Redux keeps thinking that it has to re-render my object!
each other, and Redux keeps thinking that it has to re-render everything!
The solution luckily is easy, we can tell redux to use a custom function for
comparison. I used a `shallowEquals` function to do a single-depth comparison of