Skip to content

Instantly share code, notes, and snippets.

@Falieson
Created May 31, 2018 16:30
Show Gist options
  • Save Falieson/00dedb28193ca8c579e0b807be682cc6 to your computer and use it in GitHub Desktop.
Save Falieson/00dedb28193ca8c579e0b807be682cc6 to your computer and use it in GitHub Desktop.
S1. F03. ENUM example (ARTICLE: TS-Module w/ Declarations (Part 1/4))
/** TS-Module w/ Declarations (Part 1/4)
* http://TGRstack.com/#ts-module_articles_part-1
* example of ENUM w/ Redux ./tsconfig.json (Section 1. Figure 03.)
**/
const ACTION_NAME = 'ACTION_NAME' // <== this is the ENUM
const actions = {
doAction: function (someArgs) {
return {
type: ACTION_NAME,
payload: someArgs
}
}
}
const reducer = (state = {}, action) => {
switch(action.type) {
case ACTION_NAME: actionReducer(state, action.payload)
...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment