Created
April 11, 2016 20:41
-
-
Save kushal/1f202d52dc64d7a105d858d78bb9614f to your computer and use it in GitHub Desktop.
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
** Typical Redux ** | |
dispatch({type: 'SET_DONUT', flavor: 'jelly'}) | |
reduce(state, action) { | |
... | |
case SET_DONUT: | |
return { ...state, flavor: jelly }; | |
} | |
** Proposed ** | |
dispatch({ type: 'SET_DONUT', newState: { 'flavor': 'jelly' }) | |
reduce(state, action) { | |
return { | |
...state, | |
...action.newState | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment