From an issue on React Redux @slorber wrote:
Also I'm surprised that you comment positively on this because I've just discovered "structured selectors" of Reselect. I don't find the name very good but it was built after your issue and seems to almost do what I propose here...
I was never entirely happy with the name createStructuredSelector. If we can come up with a more descriptive name that would make structured selectors more discoverable then we could make an alias for it. If anyone has any suggestions I'd love to hear them.
createSelectorFromSpec?
Thanks for the suggestion @jimbolla. I think it is along the right lines. I wonder if we can be more explicit than "Spec" though. createSelectorFromObjectShape? createSelectorWithObjectShape? They are longer than I'd ideally like.
how about
createSelectorMap - since the resulting 'structure' is map-likekey: selectormapSelectors - since it maps selectors to keys in an objectcreateSelectorMap seems not so bad. However we are just creating a selector. Couldn't we also make an overload of createSelector and detect at runtime the only param is actually a map of name -> function ?
Or maybe something like Redux? combineSelectors?
@justingreenberg createSelectorMap is pretty good
@slorber
createSelectorMap seems not so bad. However we are just creating a selector. Couldn't we also make an overload of createSelector and detect at runtime the only param is actually a map of name -> function ?
That was the original proposal, but there was concern that it wasn't explicit enough. I don't have strong objections to making it work that way, and I think its worth considering. One potential problem is that createSelector seems pretty hard to type (although I am an amateur with Flow and probably missing something) and I suspect this change would make it harder still.
I don't know enough Flow to say.
That seems strange if Flow can't handle overloads like that as they are supported by many languages however.
I like combineSelectors. It mirrors combineReducers in Redux.
+1 for combineSelectors especially since searching this project for combineReducers brought me to @mindjuice's comment above. (鈥s the only result, I would add! Perhaps a nod to the similarity could be added to the documentation, whatever the new alias actually ends up being called.)
In the meantime, if using ES6, one can simply import { createStructuredSelector as combineSelectors } from 'reselect'.
Most helpful comment
I like
combineSelectors. It mirrorscombineReducersin Redux.