[week9] mission3 디아/김정서 - #146
Open
jeongseo789-ai wants to merge 4 commits into
Open
Conversation
added 4 commits
May 27, 2026 23:22
JeongCW0522
approved these changes
Jun 2, 2026
JeongCW0522
left a comment
Collaborator
There was a problem hiding this comment.
피드백
9주차 미션 고생 많으셨습니다! 😊
이번 주차에서는 리액트의 너무너무 중요한 부분인 전역 상태 관리에 대해서 학습해보았는데 Redux부터 요즘 많이 사용하는 Zustand와 같은 상태 관리 라이브러리를 직접 활용해보면서 왜 상태관리가 중요한지, 어떤 식으로 하는지 감을 잡으셨을 것 같습니다 ㅎㅎ
이번 주차는 크게 어렵지는 않았을 거라 생각합니다!
디아가 한 코드를 보니 UI도 너무 이쁘게 잘 만들어주셨고, 상태 관리 분리도 잘 해주신 것 같습니다!
리뷰는 가볍게 보고 반영해주세요!
드디어 워크북도 한 주차를 남겨두고 있네요 ㅎㅎ
마지막 주차까지 조금만 더 힘내주세요!
그럼 10주차도 화이팅입니다!!! 💪
| export default function Modal() { | ||
| const { isOpen, closeModal } = useModalStore(); | ||
| const { clearCart } = useCartStore(); | ||
|
|
Collaborator
There was a problem hiding this comment.
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"> |
Collaborator
There was a problem hiding this comment.
보통 외부 레이아웃을 눌렀을 때 모달이 닫히도록 해주는 것이 일반적입니다 ㅎㅎ
<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); |
Collaborator
There was a problem hiding this comment.
price를 Number로 변환하는걸 보니 string으로 받는 것 같은데 그냥 CartItem 타입에서 number로 수정해주는 게 더 좋을 것 같습니다!
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.
📂 관련 이슈
🛠️ 작업 사항
📸 관련 이미지 (스크린샷 또는 동영상)
2026-05-27.11.56.51.mov
💬 기타 설명