Skip to content

Instantly share code, notes, and snippets.

@yornaath
Last active June 18, 2016 11:13
Show Gist options
  • Save yornaath/374734ce36a2996940aa3f1f5ff3c0ab to your computer and use it in GitHub Desktop.
Save yornaath/374734ce36a2996940aa3f1f5ff3c0ab to your computer and use it in GitHub Desktop.
// Defines selectors using 'reselect'
import * as breedsSelectors from '../../core/domain/breeds/selectors'
function createSelectorMap(selectors, state) {
return Object.keys(selectors).reduce((selectorMap, selectorName) => {
selectorMap[selectorName] = (...args) => selectors[selectorName](state, ...args)
return selectorMap
}, {})
}
const mapStateToProps = state => ({
breeds: createSelectorMap(breedsSelectors, state),
rapports: createSelectorMap(rapportSelectors, state)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment