Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export const commentList = (state, action) => {
- switch (action.type) {
- case 'ADD_COMMENT':
- let newComment = { comment: action.data, id: +new Date };
- return state.concat([newComment]);
- case 'DELETE_COMMENT':
- let commentId = action.data;
- default:
- return state || [];
- }
- }
- case 'DELETE_COMMENT':
- const commentId = action.data;
- return state.filter(comment => comment.id !== commentId);
- case 'DELETE_COMMENT':
- return state.filter(({ id }) => id !== action.data);
Add Comment
Please, Sign In to add comment