Open ccorcos opened 7 years ago
Yeah, forwardTo
indeed returns a new reference.
However, I am not really fan of storing memoized function arguments in the function reference itself. I could imagine _.memoize
could do the trick.
We have to decide how we want to handle this, because I do believe that this kind of performance optimization should be in user land.
_.memoize
doesnt clean up though. you'll have a memory explosion.
Doesn't this entirely destroy the laziness of React components?
https://github.com/salsita/redux-elm/blob/master/src/forwardTo.js#L14
I've come up with an interesting solution here:
https://github.com/ccorcos/elmish/blob/narrative/src/tutorial/7-lazy-react/index.js#L55-L63
Where I use shouldComponentUpdate to compare dispatch functions using a
.equals
function that remembers all the partially applied types...