Skip to content

Instantly share code, notes, and snippets.

@mattbajorek
Created March 26, 2020 02:54
Show Gist options
  • Save mattbajorek/39bec9fe8684596a41100c564a7c2dfa to your computer and use it in GitHub Desktop.
Save mattbajorek/39bec9fe8684596a41100c564a7c2dfa to your computer and use it in GitHub Desktop.
todos-redux-to-react-sweet-state utils
import { createHook } from 'react-sweet-state'
const makeSelectorsIntoHooks = (selectors, store) => (
Object.keys(selectors).reduce((accSelectors, selectorName) => {
accSelectors[selectorName] = createHook(store, {
selector: selectors[selectorName]
})
return accSelectors
}, {})
)
export default makeSelectorsIntoHooks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment