Created
July 13, 2017 16:16
-
-
Save joshdcomp/32c3dd10929338a59d4e06954db54692 to your computer and use it in GitHub Desktop.
generate a map of action types for use in Flux or Redux from an array
This file contains hidden or 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
export const actionTypes = [ | |
'ACTION_NAME', | |
].reduce((actions, action) => { | |
actions[action] = action; | |
return actions | |
}, {}); | |
//will output { ACTION_NAME: 'ACTION_NAME' } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment