I don't really know why this is true but I found if you do
compose(withHandlers(...), withState(...))
instead of
compose(withState(...), withHandlers(...))
The state props inside of the handlers will be undefined. This was confusing me for quite a while.
This is especially confusing because I expect the composed functions to run right-to-left and I wouldn't expect that the handlers would need to get added prior to the state mixin for the props to be available.
https://medium.com/@icelabaratory/why-recompose-uses-compose-19e6cb1430ac
@jethrolarson Think of them like from top to bottom
compose(
withState(...),
withHandlers(...)
)
okay, so is this the same reason that lenses compose left-to-right?
Just ordinary compose definition, having that we compose enhancers. Have no idea what lenses means. I'll close this as nothing to discuss here.
Most helpful comment
https://medium.com/@icelabaratory/why-recompose-uses-compose-19e6cb1430ac