Skip to content

[week9] mission3 디아/김정서 - #146

Open
jeongseo789-ai wants to merge 4 commits into
mainfrom
dia-week9/mission3
Open

[week9] mission3 디아/김정서#146
jeongseo789-ai wants to merge 4 commits into
mainfrom
dia-week9/mission3

Conversation

@jeongseo789-ai

Copy link
Copy Markdown

📂 관련 이슈

  • closes #[이슈 번호]

🛠️ 작업 사항

  • [ ]
  • [ ]

📸 관련 이미지 (스크린샷 또는 동영상)

2026-05-27.11.56.51.mov

💬 기타 설명

💡 추가적으로 공유할 내용이나 리뷰어에게 전달할 사항이 있다면 작성해 주세요.

@jeongseo789-ai jeongseo789-ai self-assigned this May 27, 2026

@JeongCW0522 JeongCW0522 left a comment

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.

피드백

9주차 미션 고생 많으셨습니다! 😊
이번 주차에서는 리액트의 너무너무 중요한 부분인 전역 상태 관리에 대해서 학습해보았는데 Redux부터 요즘 많이 사용하는 Zustand와 같은 상태 관리 라이브러리를 직접 활용해보면서 왜 상태관리가 중요한지, 어떤 식으로 하는지 감을 잡으셨을 것 같습니다 ㅎㅎ

이번 주차는 크게 어렵지는 않았을 거라 생각합니다!
디아가 한 코드를 보니 UI도 너무 이쁘게 잘 만들어주셨고, 상태 관리 분리도 잘 해주신 것 같습니다!
리뷰는 가볍게 보고 반영해주세요!

드디어 워크북도 한 주차를 남겨두고 있네요 ㅎㅎ
마지막 주차까지 조금만 더 힘내주세요!

그럼 10주차도 화이팅입니다!!! 💪

export default function Modal() {
const { isOpen, closeModal } = useModalStore();
const { clearCart } = useCartStore();

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.

esc로 모달을 닫는 기능도 추가해주세요!

  useEffect(() => {
    if (!isOpen) return;

    const handleKeyDown = (e: KeyboardEvent) => {
      if (e.key === 'Escape') {
        closeModal();
      }
    };

    window.addEventListener('keydown', handleKeyDown);

    return () => {
      window.removeEventListener('keydown', handleKeyDown);
    };
  }, [isOpen, closeModal]);

if (!isOpen) return null;

return (
<div className="fixed inset-0 bg-black/60 z-50 flex items-center justify-center">

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.

보통 외부 레이아웃을 눌렀을 때 모달이 닫히도록 해주는 것이 일반적입니다 ㅎㅎ

<div
      className="fixed inset-0 bg-black/60 z-50 flex items-center justify-center"
      onClick={closeModal}
    >

let total = 0;
items.forEach((item) => {
amount += item.amount;
total += item.amount * Number(item.price);

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.

price를 Number로 변환하는걸 보니 string으로 받는 것 같은데 그냥 CartItem 타입에서 number로 수정해주는 게 더 좋을 것 같습니다!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants