Skip to content

Instantly share code, notes, and snippets.

@toruticas
Last active July 4, 2018 02:43
Show Gist options
  • Save toruticas/82867c90d59f61e37482175324737307 to your computer and use it in GitHub Desktop.
Save toruticas/82867c90d59f61e37482175324737307 to your computer and use it in GitHub Desktop.
[Medium] Example of bad usage of redux
export default (action, state) => {
switch(action.type) {
case FIRST_EXAMPLE:
return {
...state,
quickbarIsOpen: true,
dfes: {
...state.dfes,
nfes: {
...state.dfes.nfes,
data: state.dfes.nfes.data.map((nfe, index) => ({
...nfe,
visible: index === action.index,
}),
},
},
}
default:
return state
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment