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
1 changed files with 1 additions and 1 deletions

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 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 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 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 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 comparison. I used a `shallowEquals` function to do a single-depth comparison of