memoize: specify equality check
See original GitHub issueI would like to be able to specify the equality check of my memoize
instead of serialising the arguments and check their values equality, for an Object
or an Array
I want to be able to do a reference equality check.
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Reselect's Memoization in 3 Functions | HackerNoon.com |
so the first function in Reselect is a simple equality check which is used to determine the equality of arguments passed into the...
Read more >How to create a custom equality function with reselect and ...
A standard reselect selector invalidates its memoized value and recomputes it if the input selectors fail a strict equality check:
Read more >Improving React application performance: React.memo vs ...
memo can use our custom equality check function to determine if the props for the BarGraph component have changed and if it should...
Read more >How To Use Memoization To Drastically Increase React ...
This referential equality is really useful when comparing objects in dependency arrays, but if you need to use a function in a dependency...
Read more >When should you memoize in React - Prateek Surana
And since typeof children === 'object , the equality check in memo always returns false, so whenever the parent re-renders, it will cause ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Bradcomp:
That works. If someone wants to push for this I wouldn’t fight it. But…
I find I care very little about
memoize
. I’ll probably be kicking myself the next time my CRUD service is in desperate need of fast access to the Fibonacci numbers, but there you have it.@CrossEye I think I’ve used it exactly once in production code, so I’m right there with you, although I might get double or even triple the usage out of it if serialization was more efficient 😜
memoizeBy
seems like a much easier solution than allowing for arbitrary equality comparisons, which would require a whole different approach as @davidchambers mentioned.