Skip to content

Instantly share code, notes, and snippets.

@sht5
Created January 19, 2018 21:23
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 sht5/ba622250317718cfc6cec2f8cca9d12f to your computer and use it in GitHub Desktop.
Save sht5/ba622250317718cfc6cec2f8cca9d12f to your computer and use it in GitHub Desktop.
using generateSuccessActionTypeName in reducer
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