Created
June 6, 2017 19:51
-
-
Save tricoder42/a04243a6bb923d8dcd1c8fb3071a24d6 to your computer and use it in GitHub Desktop.
2017/06/06 [Medium] Use Selectors in Redux for Great Good
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// const reducer = ... | |
const ID = 'auth' | |
const local = state => state[ID] | |
const getUser = state => local(state).user | |
const isAuthenticated = state => Boolean(getUser(state)) | |
export default {[ID]: reducer} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How is the state variable reachable outside of the reducer function?