Skip to content

Instantly share code, notes, and snippets.

@LiorB-D
Created April 1, 2022 00:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LiorB-D/fc1572ed0fc35045c63a5e4f4a0e04e7 to your computer and use it in GitHub Desktop.
Save LiorB-D/fc1572ed0fc35045c63a5e4f4a0e04e7 to your computer and use it in GitHub Desktop.
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