Created
April 1, 2022 00:27
-
-
Save LiorB-D/fc1572ed0fc35045c63a5e4f4a0e04e7 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
import * as actionTypes from '../actions/actionTypes'; | |
export default (state = [], action) => { | |
switch (action.type){ | |
case actionTypes.CREATE_NEW_TODO: | |
return [ | |
...state, | |
Object.assign({}, action.todo) | |
]; | |
case actionTypes.REMOVE_TODO: | |
return state.filter((data, i) => i !== action.id); | |
default: | |
return state; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment