Skip to content

Conversation

@wupe1001
Copy link

✅ 워크북 체크리스트

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

✅ 컨벤션 체크리스트

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

📌 주안점

@wupe1001 wupe1001 requested a review from sunnyinha November 26, 2025 08:30
@wupe1001 wupe1001 self-assigned this Nov 26, 2025
@wupe1001 wupe1001 linked an issue Nov 26, 2025 that may be closed by this pull request
};

const handleDecrease = () => {
if (lp.amount === 1) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

if 문 안에서 개수가 1개 남았을 때 삭제하도록 removeitem을 사용하셨는데
그 이후에 아이템 개수 감소 하는 줄이 실행이 됩니다.
삭제된 상태(undefined)에서 개수 감소가 일어날 수 없지만
redux에서 item 개수가 없는 부분에 대해 실행되지 않도록 에러 처리를 미리해두어 현재 에러는 나지 않습니다.
그러나 코드 로직을 정확하게 하려면 if문 끝에 return 하나를 넣어서 삭제 후에는 아래 decrease가 작동하지 않도록 바꾸는 것을 더 추천드립니다!

import { useModalActions, useModalInfo } from "../hooks/useModalStore";
import Modal from "./Modal";

const TotalPrice = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

hooks 에다가 액션 다 정리하고 여기서는 ui에 해당 액션들 넣어주기만 해서
구조, 역할 분리를 굉장히 잘하셨어요!

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

2 participants