Created
April 29, 2017 19:06
-
-
Save osanyin/e02aa01b2ea1b5b1db2c41f093c240ab to your computer and use it in GitHub Desktop.
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
| function todoApp(state = initialState, action) { | |
| switch (action.type) { | |
| case SET_VISIBILITY_FILTER: | |
| return Object.assign({}, state, { | |
| visibilityFilter: action.filter | |
| }) | |
| case ADD_TODO: | |
| return Object.assign({}, state, { | |
| todos: [ | |
| ...state.todos, | |
| { | |
| text: action.text, | |
| completed: false | |
| } | |
| ] | |
| }) | |
| default: | |
| return state | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment