Created
January 19, 2018 21:23
-
-
Save sht5/ba622250317718cfc6cec2f8cca9d12f to your computer and use it in GitHub Desktop.
using generateSuccessActionTypeName in reducer
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
switch (action.type) { | |
case generateSuccessActionTypeName(types.GET_COINS): { | |
const {coins} = action; | |
const currentAmountOfCoins = state[consts.STATE_INNER_OBJECT_NAMES.COINS]; | |
return { | |
...state, | |
[consts.STATE_INNER_OBJECT_NAMES.COINS]: currentAmountOfCoins + coins | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment