Skip to content

Instantly share code, notes, and snippets.

@joshdcomp
Created July 13, 2017 16:16
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 joshdcomp/32c3dd10929338a59d4e06954db54692 to your computer and use it in GitHub Desktop.
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
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