Created
February 27, 2017 03:25
-
-
Save hanipcode/77b1b1bbd5c5cf3e9363a0a9584c421e to your computer and use it in GitHub Desktop.
redux real world example error reducer
This file contains hidden or 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
| const errorMessage = (state = null, action) => { | |
| const { type, error } = action | |
| if (type === ActionTypes.RESET_ERROR_MESSAGE) { | |
| return null | |
| } else if (error) { | |
| return error | |
| } | |
| return state | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment