Skip to content

Comments

Create Week9 Mission1, 2, 3#105

Merged
geg222 merged 2 commits intomainfrom
geg222
May 31, 2025
Merged

Create Week9 Mission1, 2, 3#105
geg222 merged 2 commits intomainfrom
geg222

Conversation

@geg222
Copy link
Collaborator

@geg222 geg222 commented May 25, 2025

📝 미션 번호

9주차 Misson 1,2,3

📋 구현 사항

  • redux-toolkit 활용한 장바구니 만들기
  • Modal Slice 활용하여, 모달 기능
  • 미션 1, 2를 Zustand 활용하여 리팩토링

📎 스크린샷

스크린샷 2025-05-25 오후 8 03 59 스크린샷 2025-05-25 오후 8 04 05
2025-05-25.8.03.26.mov

✅ 체크리스트

  • Merge 하려는 브랜치가 올바르게 설정되어 있나요?
  • 로컬에서 실행했을 때 에러가 발생하지 않나요?
  • 불필요한 주석이 제거되었나요?
  • 코드 스타일이 일관적인가요?

🤔 질문 사항

@geg222 geg222 self-assigned this May 25, 2025
Copy link
Member

@hyesngy hyesngy left a comment

Choose a reason for hiding this comment

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

정말 고생 많으셨습니다! 👏🏻👏🏻👏🏻

이번 주 워크북을 통해 Redux ToolkitZustand 두 가지 상태관리 라이브러리를 모두 다뤄보았습니다. 앞으로 프로젝트 복잡도나 규모에 따라 적절한 상태관리 도구를 선택할 수 있는 안목을 갖추게 되셨으면 좋겠습니다! 👍🏻👍🏻👍🏻

현재 장바구니 데이터가 새로고침 시 초기화되고 있는데, Redux Toolkit의 redux-persist나 Zustand의 persist 미들웨어를 적용하여, 새로고침 후에도 장바구니 상태가 유지되도록 🚀Challenge 미션에 도전해 보시면 좋겠습니다!

import { useSelector } from "../hooks/useCustomRedux";

const CartList = () => {
const { cartItems } = ({} = useSelector((state) => state.cart));
Copy link
Member

Choose a reason for hiding this comment

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

현재 CartList에서 useSelector를 통해 상태를 가져올 때 중간에 불필요한 할당 연산과 빈 객체가 포함된 구조분해할당을 사용하고 있는데, 아래처럼 수정하면 코드 의도가 명확해지고 가독성도 올라갈 것 같습니다!
(참고 : https://eslint.org/docs/latest/rules/no-empty-pattern)

Suggested change
const { cartItems } = ({} = useSelector((state) => state.cart));
const { cartItems } = useSelector((state) => state.cart);

Comment on lines +11 to +16
<Provider store={store}>
<Navbar />
<CartList />
<PriceBox />
<Modal />
</Provider>
Copy link
Member

Choose a reason for hiding this comment

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

현재 미션 3의 App.tsx 에서 Redux의 Provider로 감싸고 있는데, 미션 3에서는 Zustand로 상태 관리를 전환했기 때문에 이 부분은 제거해야 합니다. 또한, store 폴더와 slices 폴더의 Redux 관련 파일들도 여전히 남아있는데, 프로젝트 구조를 명확하게 하기 위해 해당 파일들도 제거하는 것을 권장합니다!

@geg222 geg222 merged commit 217b757 into main May 31, 2025
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