Created
May 31, 2018 16:30
-
-
Save Falieson/00dedb28193ca8c579e0b807be682cc6 to your computer and use it in GitHub Desktop.
S1. F03. ENUM example (ARTICLE: TS-Module w/ Declarations (Part 1/4))
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
/** 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