Skip to content

Instantly share code, notes, and snippets.

@AJamesPhillips
Last active May 3, 2019 11:58
Show Gist options
  • 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