Skip to content

Conversation

@dongyeol02
Copy link
Collaborator

πŸ“ λ―Έμ…˜ 번호

9μ£Όμ°¨ Mission1,2,3,

πŸ“‹ κ΅¬ν˜„ 사항

  • Redux tool을 μ΄μš©ν•˜μ—¬ μ „μ—­μƒνƒœ 관리
    -modal을 톡해 μ§„μ§œ μ‚­μ œν• κ±΄μ§€ λ‚˜νƒ€λƒ„
  • 이 κΈ°λŠ₯을 zustandλ₯Ό 톡해 λ°”κΏˆ

πŸ“Ž μŠ€ν¬λ¦°μƒ·

스크란샷 2025-05-27 α„‹α…©α„Œα…₯ᆫ 11 42 37

βœ… 체크리슀트

  • [x ] Merge ν•˜λ €λŠ” λΈŒλžœμΉ˜κ°€ μ˜¬λ°”λ₯΄κ²Œ μ„€μ •λ˜μ–΄ μžˆλ‚˜μš”?
  • λ‘œμ»¬μ—μ„œ μ‹€ν–‰ν–ˆμ„ λ•Œ μ—λŸ¬κ°€ λ°œμƒν•˜μ§€ μ•Šλ‚˜μš”?
  • [x ] λΆˆν•„μš”ν•œ 주석이 μ œκ±°λ˜μ—ˆλ‚˜μš”?
  • [x ] μ½”λ“œ μŠ€νƒ€μΌμ΄ μΌκ΄€μ μΈκ°€μš”?

πŸ€” 질문 사항

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 Toolkitκ³Ό Zustand 두 κ°€μ§€ μƒνƒœκ΄€λ¦¬ 라이브러리λ₯Ό λͺ¨λ‘ λ‹€λ€„λ³΄μ•˜μŠ΅λ‹ˆλ‹€. μ•žμœΌλ‘œ ν”„λ‘œμ νŠΈ λ³΅μž‘λ„λ‚˜ 규λͺ¨μ— 따라 μ μ ˆν•œ μƒνƒœκ΄€λ¦¬ 도ꡬλ₯Ό 선택할 수 μžˆλŠ” μ•ˆλͺ©μ„ κ°–μΆ”κ²Œ λ˜μ…¨μœΌλ©΄ μ’‹κ² μŠ΅λ‹ˆλ‹€! πŸ‘πŸ»πŸ‘πŸ»πŸ‘πŸ»

Comment on lines +1 to +19
import { configureStore } from "@reduxjs/toolkit";
import cartReducer from "../slices/cartSlice";
import modalReducer from "../slices/modalSlice";

function createStore() {
const store = configureStore({
reducer: {
cart: cartReducer,
modal: modalReducer,
},
});
return store;
}

const store = createStore();
export default store;

export type RootState = ReturnType<typeof store.getState>;
export type AppDispatch = typeof store.dispatch;
Copy link
Member

Choose a reason for hiding this comment

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

ν˜„μž¬ μž₯λ°”κ΅¬λ‹ˆ 데이터가 μƒˆλ‘œκ³ μΉ¨ μ‹œ μ΄ˆκΈ°ν™”λ˜κ³  μžˆλŠ”λ°, Redux Toolkit의 redux-persistλ‚˜ Zustand의 persist 미듀웨어λ₯Ό μ μš©ν•˜μ—¬, μƒˆλ‘œκ³ μΉ¨ 후에도 μž₯λ°”κ΅¬λ‹ˆ μƒνƒœκ°€ μœ μ§€λ˜λ„λ‘ πŸš€Challenge λ―Έμ…˜μ— 도전해 λ³΄μ‹œλ©΄ μ’‹κ² μŠ΅λ‹ˆλ‹€!

Comment on lines +5 to +7
const Modal = () => {
const dispatch = useDispatch();
const isOpen = useSelector((state) => state.modal.isOpen);
Copy link
Member

Choose a reason for hiding this comment

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

ν˜„μž¬ λ―Έμ…˜ 3μ—μ„œ μž₯λ°”κ΅¬λ‹ˆλŠ” Zustand둜 잘 κ΄€λ¦¬ν•˜κ³  μžˆμ§€λ§Œ, λͺ¨λ‹¬μ€ 아직 Redux둜 κ΄€λ¦¬ν•˜κ³  μžˆμ–΄ 혼재된 μƒνƒœμž…λ‹ˆλ‹€.

Modal.tsxμ—μ„œ useDispatch와 useSelectorλ₯Ό μ‚¬μš©ν•˜μ—¬ Redux의 modalSliceλ₯Ό μ°Έμ‘°ν•˜κ³  있고, PriceBox.tsxμ—μ„œλ„ openModal μ•‘μ…˜μ„ Redux둜 λ””μŠ€νŒ¨μΉ˜ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€. λͺ¨λ‹¬ μƒνƒœ 관리도 Zustand둜 μ™„μ „νžˆ λ§ˆμ΄κ·Έλ ˆμ΄μ…˜ν•΄μ•Ό ν•©λ‹ˆλ‹€.

Comment on lines +9 to +18
function App() {
return (
<Provider store={store}>
<Navbar />
<CartList />
<Modal />
<PriceBox />
</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.ts, cartSlice.ts λ“± Redux κ΄€λ ¨ νŒŒμΌλ“€μ΄ μ—¬μ „νžˆ λ‚¨μ•„μžˆλŠ”λ°, ν”„λ‘œμ νŠΈ ꡬ쑰λ₯Ό λͺ…ν™•ν•˜κ²Œ ν•˜κΈ° μœ„ν•΄ ν•΄λ‹Ή νŒŒμΌλ“€λ„ μ œκ±°ν•˜λŠ” 것을 ꢌμž₯ν•©λ‹ˆλ‹€!

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.

10μ£Όμ°¨ μ›Œν¬λΆκΉŒμ§€ 정말 κΈ΄ μ—¬μ •μ΄μ—ˆμŠ΅λ‹ˆλ‹€.

κ·Έλ™μ•ˆ λͺ¨λ‘ 고생 λ§ŽμœΌμ…¨μŠ΅λ‹ˆλ‹€! πŸ‘πŸ»πŸ‘πŸ»πŸ‘πŸ» μ§§μ§€ μ•Šμ€ κΈ°κ°„λ™μ•ˆ 의미 μžˆλŠ” μ‹œκ°„μ΄ λ˜μ—ˆκΈ°λ₯Ό λ°”λžλ‹ˆλ‹€.

이제 κΈ°λ³Έ μ›Œν¬λΆμ€ λͺ¨λ‘ μ™„μ£Όν•˜μ…¨μ§€λ§Œ, 11-12μ£Όμ°¨ μ›Œν¬λΆλ„ λ„μ „ν•΄λ³΄μ‹œκΈΈ μΆ”μ²œλ“œλ¦½λ‹ˆλ‹€! 11μ£Όμ°¨μ—μ„œλŠ” Vercel을 ν™œμš©ν•œ 배포와 CI/CD ꡬ성을 닀루고, 12μ£Όμ°¨μ—μ„œλŠ” WebSocket을 μ΄μš©ν•œ μ‹€μ‹œκ°„ 톡신과 Cypressλ₯Ό ν™œμš©ν•œ E2E ν…ŒμŠ€νŠΈλ₯Ό λ‹€λ£Ήλ‹ˆλ‹€.

μ•žμœΌλ‘œλ„ κΎΈμ€€νžˆ ν•™μŠ΅ν•˜κ³  μ„±μž₯ν•˜μ‹œκΈΈ μ‘μ›ν•˜λ©°, 데λͺ¨λ°μ΄κΉŒμ§€ ν™”μ΄νŒ… μž…λ‹ˆλ‹€! πŸ‘πŸ»πŸ‘πŸ»πŸ‘πŸ»

Comment on lines +5 to +6
const useFetch = <T>(url: string, options?: AxiosRequestConfig) => {
const [data, setData] = useState<string | null>(null);
Copy link
Member

Choose a reason for hiding this comment

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

ν˜„μž¬ useFetchμ—μ„œ μ œλ„€λ¦­ <T>λ₯Ό μ„ μ–Έν•΄λ†¨μ§€λ§Œ μ‹€μ œλ‘œλŠ” ν™œμš©ν•˜μ§€ λͺ»ν•˜κ³  μžˆλŠ” μƒν™©μž…λ‹ˆλ‹€.
useState<string | null>(null)둜 ν•˜λ“œμ½”λ”©λ˜μ–΄ μžˆμ–΄μ„œ Homepage.tsxμ—μ„œ useFetch<MovieResponse>둜 ν˜ΈμΆœν•΄λ„ data의 νƒ€μž…μ΄ string으둜 κ³ μ •λ˜μ–΄ λ²„λ¦½λ‹ˆλ‹€.

이둜 인해 data?.results에 μ ‘κ·Όν•  λ•Œ TypeScriptκ°€ μ˜¬λ°”λ₯Έ νƒ€μž… 좔둠을 ν•˜μ§€ λͺ»ν•˜κ³ , λŸ°νƒ€μž„μ—μ„œ μ˜ˆμƒμΉ˜ λͺ»ν•œ μ—λŸ¬κ°€ λ°œμƒν•  μœ„ν—˜μ΄ μžˆμŠ΅λ‹ˆλ‹€. μ œλ„€λ¦­ νƒ€μž… Tλ₯Ό ν™œμš©ν•˜μ—¬ useState<T | null>(null)둜 μˆ˜μ •ν•˜λ©΄ ν˜ΈμΆœν•˜λŠ” κ³³μ—μ„œ μ§€μ •ν•œ νƒ€μž…(MovieResponse)이 μ œλŒ€λ‘œ λ°˜μ˜λ˜μ–΄ νƒ€μž… μ•ˆμ •μ„±μ΄ 크게 ν–₯상될 κ²ƒμž…λ‹ˆλ‹€!

Suggested change
const useFetch = <T>(url: string, options?: AxiosRequestConfig) => {
const [data, setData] = useState<string | null>(null);
const useFetch = <T>(url: string, options?: AxiosRequestConfig) => {
const [data, setData] = useState<T | null>(null);

Copy link
Member

Choose a reason for hiding this comment

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

ν˜„μž¬ μ½”λ“œλ₯Ό 보면 10μ£Όμ°¨ μ›Œν¬λΆ λ―Έμ…˜μΈ 검색 κΈ°λŠ₯에 μ§‘μ€‘ν•œ ꡬ쑰둜 λ˜μ–΄ μžˆλŠ”λ°, μ§€λ‚œ λ―Έμ…˜μ΄μ—ˆλ˜ μ˜ν™” νŽ˜μ΄μ§€μ™€ ν†΅ν•©ν•˜λ©΄ 더 완성도 높은 μ˜ν™” μ‚¬μ΄νŠΈκ°€ 될 것 κ°™μŠ΅λ‹ˆλ‹€!

Copy link
Member

Choose a reason for hiding this comment

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

πŸš€Challenge λ―Έμ…˜μ— 따라 ν”„λ‘œμ νŠΈ μ „μ²΄μ˜ μ„±λŠ₯ μ΅œμ ν™”λ‚˜ UX κ°œμ„ μ—λ„ λ„μ „ν•΄λ³΄μ„Έμš”! μ½”λ“œ ν’ˆμ§ˆ μΈ‘λ©΄μ—μ„œλ„ 쀑볡 제거, μ±…μž„ 뢄리, μ˜ˆμ™Έ 처리 κ°œμ„  등을 톡해 가독성과 μœ μ§€λ³΄μˆ˜μ„±μ΄ 쒋은 μ½”λ“œλ‘œ λ¦¬νŒ©ν† λ§ 해보면 μ–΄λ–¨κΉŒμš” 😊

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.

3 participants