So I read the issues related to selectors taking no arguments (#18, #38, #59) and I understand the reasoning behind it: that if you feel the need to create a selector with a dynamic argument, probably that argument should be in your store state somewhere.
Only I don't believe that's necessarily true. In a project I'm working on we keep the router state in the router itself and don't jump through extra hoops to sync this with the store state. I think this too is a pretty well established pattern. It would be great to be able to pass the router state into a selector as an argument.
I'm curious to hear your thoughts :smile:.
When using connect, component props are passed as the second argument to the selector. This allows you to use the pattern referenced in your link.
More details here: https://github.com/reactjs/reselect#createselectorinputselectors--inputselectors-resultfunc
I should have found that myself, that works nicely. Thanks for your reponse!
@ellbee what if you don't want to couple your component code to your selector code? What's to stop someone from passing in a custom props object there? Isn't the essentially the same as passing args?
Most helpful comment
@ellbee what if you don't want to couple your component code to your selector code? What's to stop someone from passing in a custom props object there? Isn't the essentially the same as passing args?