Skip to content

[9주차/채채]워크북 제출합니다 - #106

Merged
chxxwn04 merged 6 commits into
UMC-Inha:채채/mainfrom
chxxwn04:main
Dec 1, 2025
Merged

chxxwn04 merged 6 commits into
UMC-Inha:채채/mainfrom
chxxwn04:main

Conversation

@chxxwn04

@chxxwn04 chxxwn04 commented Nov 27, 2025 •

Copy link
Copy Markdown

✅ 워크북 체크리스트

  • 모든 핵심 키워드 정리를 마쳤나요?
  • 핵심 키워드에 대해 완벽히 이해하셨나요?
  • 이론 학습 이후 직접 실습을 해보는 시간을 가졌나요?
  • 미션을 수행하셨나요?
  • 미션을 기록하셨나요?

✅ 컨벤션 체크리스트

  • 디렉토리 구조 컨벤션을 잘 지켰나요?
  • pr 제목을 컨벤션에 맞게 작성하였나요?
  • pr에 해당되는 이슈를 연결하였나요?(중요)
  • 적절한 라벨을 설정하였나요?
  • 파트장에게 code review를 요청하기 위해 reviewer를 등록하였나요?
  • 닉네임/main 브랜치의 최신 상태를 반영하고 있는지 확인했나요?(매우 중요!)

📌 주안점

@chxxwn04 chxxwn04 self-assigned this Nov 27, 2025
@chxxwn04
chxxwn04 requested a review from sunnyinha as a code owner November 27, 2025 14:49
@chxxwn04 chxxwn04 linked an issue Nov 27, 2025 that may be closed by this pull request
state.cartItems = state.cartItems.filter(
(cartItem) => cartItem.id !== itemId
);
},

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
    },

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

반영했습니당

<Navbar />
<CartList />
<PriceBox />
{isModalOpen && <Modal />}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

조건부 렌더링으 isModalOpen === true일 때만 이 렌더링되게 한 것이 효율적인것같아요

아니요
</button>
<button
onClick={handleYes}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

모달에서 장바구니 아이템을 모두 삭제 가능하도록 clearCart()함수를 불러와서 잘 적용한 것 같습니다!

@sunnyinha

Copy link
Copy Markdown
Collaborator

채채 9주차도 열심히 해주셔서 감사합니다~! 머지해주세요!
시험 끝나고 10주차까지 잘 마무리해봅시다!

@chxxwn04
chxxwn04 merged commit 68cbfe0 into UMC-Inha:채채/main Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chapter09_Redux Toolkit / Zustand

4 participants