Repository navigation
[9주차/채채]워크북 제출합니다 - #106
Merged
Merged
Conversation
sunnyinha
reviewed
Nov 29, 2025
| state.cartItems = state.cartItems.filter( | ||
| (cartItem) => cartItem.id !== itemId | ||
| ); | ||
| }, |
Collaborator
There was a problem hiding this comment.
calculateTotals()를 increase/decrease/removeItem 안에서 함께 처리하면
Navbar UI에서 useeffect로 다시 재계산할 필요가 없어집니다!
상태 변경 로직이 모두 slice에 모여서 구조가 더 명확해지고,
Navbar에서 cartItems 전체를 의존성으로 들고 있을 필요도 없어져서
렌더링도 가벼워지는 장점이 있어서 변경해보는 걸 추천드립니다!
increase: (state, action: PayloadAction<{ id: string }>) => {
const itemId = action.payload.id;
const item = state.cartItems.find((cartItem) => cartItem.id === itemId);
if (item) item.amount++;
cartSlice.caseReducers.calculateTotals(state);
},
wooojin401
reviewed
Nov 30, 2025
| <Navbar /> | ||
| <CartList /> | ||
| <PriceBox /> | ||
| {isModalOpen && <Modal />} |
There was a problem hiding this comment.
조건부 렌더링으 isModalOpen === true일 때만 이 렌더링되게 한 것이 효율적인것같아요
aeongiing
reviewed
Nov 30, 2025
| 아니요 | ||
| </button> | ||
| <button | ||
| onClick={handleYes} |
Member
There was a problem hiding this comment.
모달에서 장바구니 아이템을 모두 삭제 가능하도록 clearCart()함수를 불러와서 잘 적용한 것 같습니다!
Collaborator
|
채채 9주차도 열심히 해주셔서 감사합니다~! 머지해주세요! |
sunnyinha
approved these changes
Nov 30, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
✅ 워크북 체크리스트
✅ 컨벤션 체크리스트
📌 주안점