Skip to content

Instantly share code, notes, and snippets.

@AJamesPhillips
Last active May 3, 2019 11:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AJamesPhillips/31859809c949b3807cfb9014a5b24460 to your computer and use it in GitHub Desktop.
Save AJamesPhillips/31859809c949b3807cfb9014a5b24460 to your computer and use it in GitHub Desktop.
Small function for combining redux selectors
function wrap_selectors (selectors, state_path) {
const wrapped_selectors = {}
Object.keys(selectors).forEach(selector_key => {
wrappedSelectors[selectorKey] = (state, ...args) => selectors[selectorKey](state[statePath], ...args)
})
return wrapped_selectors
}
export const selectors = {
...wrap_selectors(shared_datetime_selectors, "shared_datetime"),
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment