Skip to content

Commit

Permalink
1つの商品を削除するReducerを作成しよう:その2
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yoshiii committed Sep 5, 2022
1 parent 2dfef26 commit 8af893b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/features/cart/CartSlice.js
Expand Up @@ -14,7 +14,8 @@ const cartSlice = createSlice({
return { cartItems: [], amount: 0, total: 0 };
},
removeItem: (state, action) => {
console.log(action);
const itemId = action.payload;
state.cartItems = state.cartItems.filter((item) => item.id !== itemId);
},
},
});
Expand Down

0 comments on commit 8af893b

Please sign in to comment.