Kaan Barmore-Genç 2 weeks ago
parent 6606e5751d
commit 985777a1e9
Signed by: kaan
GPG Key ID: B2E280771CD62FCF
  1. 2
      content/posts/2022.09.18.solving-react-redux-triggering-too-many-re-renders.md

@ -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

Loading…
Cancel
Save