Skip to content

Instantly share code, notes, and snippets.

@tricoder42
Created June 6, 2017 19:51
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 tricoder42/a04243a6bb923d8dcd1c8fb3071a24d6 to your computer and use it in GitHub Desktop.
Save tricoder42/a04243a6bb923d8dcd1c8fb3071a24d6 to your computer and use it in GitHub Desktop.
2017/06/06 [Medium] Use Selectors in Redux for Great Good
// 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}
@notflip
Copy link

notflip commented Dec 14, 2018

How is the state variable reachable outside of the reducer function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment