Skip to content

Conversation

@joyeeon
Copy link
Collaborator

@joyeeon joyeeon commented May 26, 2025

๐Ÿ“ ๋ฏธ์…˜ ๋ฒˆํ˜ธ

9์ฃผ์ฐจ Misson 1,2,3

๐Ÿ“‹ ๊ตฌํ˜„ ์‚ฌํ•ญ

  • playlist ๊ตฌํ˜„
  • redux toolkit ์ด์šฉ
  • modal ๊ตฌํ˜„
  • zustand๋กœ ๋ฆฌํŒฉํ† ๋ง

๐Ÿ“Ž ์Šคํฌ๋ฆฐ์ƒท

2025-05-26.174014.mp4

โœ… ์ฒดํฌ๋ฆฌ์ŠคํŠธ

  • Merge ํ•˜๋ ค๋Š” ๋ธŒ๋žœ์น˜๊ฐ€ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์„ค์ •๋˜์–ด ์žˆ๋‚˜์š”?
  • ๋กœ์ปฌ์—์„œ ์‹คํ–‰ํ–ˆ์„ ๋•Œ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š๋‚˜์š”?
  • ๋ถˆํ•„์š”ํ•œ ์ฃผ์„์ด ์ œ๊ฑฐ๋˜์—ˆ๋‚˜์š”?
  • ์ฝ”๋“œ ์Šคํƒ€์ผ์ด ์ผ๊ด€์ ์ธ๊ฐ€์š”?

๐Ÿค” ์งˆ๋ฌธ ์‚ฌํ•ญ

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 +18 to +39
increment: (state, action: PayloadAction<string>) => {
const item = state.items.find((i) => i.id === action.payload);
if (item) {
item.amount += 1;
}
},
decrement: (state, action: PayloadAction<string>) => {
const item = state.items.find((i) => i.id === action.payload);
if (item) {
item.amount -= 1;
if (item.amount < 1) {
// 1๋ณด๋‹ค ์ž‘์œผ๋ฉด ์ œ๊ฑฐ
state.items = state.items.filter((i) => i.id !== action.payload);
}
}
},
removeItem: (state, action: PayloadAction<string>) => {
state.items = state.items.filter((i) => i.id !== action.payload);
},
clearCart: (state) => {
state.items = [];
}
Copy link
Member

Choose a reason for hiding this comment

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

ํ˜„์žฌ cartSlice์—์„œ increment, decrement, removeItem, clearCart ์•ก์…˜๋“ค์ด ๊ตฌํ˜„๋˜์–ด ์žˆ๋Š”๋ฐ, ์š”๊ตฌ์‚ฌํ•ญ์˜ calculateTotals ์•ก์…˜์ด ๋ˆ„๋ฝ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ์š”๊ตฌ์‚ฌํ•ญ๋Œ€๋กœ ์ดํ•ฉ ๊ณ„์‚ฐ ๋กœ์ง์„ ๋ณ„๋„ ์•ก์…˜์œผ๋กœ ๋ถ„๋ฆฌํ•˜๋ฉด ์ƒํƒœ ๊ด€๋ฆฌ๊ฐ€ ๋” ๋ช…ํ™•ํ•ด์งˆ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค!

Comment on lines +5 to +10
export const store = configureStore({
reducer: {
cart: cartReducer,
modal: modalRedcer
},
})
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 ๋ฏธ์…˜์— ๋„์ „ํ•ด ๋ณด์‹œ๋ฉด ์ข‹๊ฒ ์Šต๋‹ˆ๋‹ค!



return (
<nav className="fix top-0 bg-blue-900 text-white flex items-center justify-between w-full h-[50px]">
Copy link
Member

Choose a reason for hiding this comment

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

ํ˜„์žฌ Navbar์—์„œ fix ํด๋ž˜์Šค๊ฐ€ fixed ์˜ ์˜คํƒ€๋กœ ๋ณด์ž…๋‹ˆ๋‹ค! ๋„ค๋น„๊ฒŒ์ด์…˜ ๊ณ ์ •์„ ์˜๋„ํ•œ ๊ฒƒ ๊ฐ™์€๋ฐ, ํ˜„์žฌ๋Š” ๋„ค๋น„๊ฒŒ์ด์…˜์ด ๊ณ ์ •๋˜์ง€ ์•Š๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฅผ ์ˆ˜์ •ํ•˜๋ฉด ์Šคํฌ๋กค ์‹œ์—๋„ ์žฅ๋ฐ”๊ตฌ๋‹ˆ ์ •๋ณด๊ฐ€ ํ•ญ์ƒ ๋ณด์ด๋„๋ก ํ•  ์ˆ˜ ์žˆ์–ด ์‚ฌ์šฉ์„ฑ์ด ๊ฐœ์„ ๋  ๊ฒƒ ๊ฐ™์•„์š”!

Suggested change
<nav className="fix top-0 bg-blue-900 text-white flex items-center justify-between w-full h-[50px]">
<nav className="fixed top-0 bg-blue-900 text-white flex items-center justify-between w-full h-[50px]">



return (
<nav className="fix top-0 bg-blue-900 text-white flex items-center justify-between w-full h-[50px]">
Copy link
Member

Choose a reason for hiding this comment

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

ํ˜„์žฌ Navbar์—์„œ fix ํด๋ž˜์Šค๊ฐ€ fixed ์˜ ์˜คํƒ€๋กœ ๋ณด์ž…๋‹ˆ๋‹ค! ๋„ค๋น„๊ฒŒ์ด์…˜ ๊ณ ์ •์„ ์˜๋„ํ•œ ๊ฒƒ ๊ฐ™์€๋ฐ, ํ˜„์žฌ๋Š” ๋„ค๋น„๊ฒŒ์ด์…˜์ด ๊ณ ์ •๋˜์ง€ ์•Š๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฅผ ์ˆ˜์ •ํ•˜๋ฉด ์Šคํฌ๋กค ์‹œ์—๋„ ์žฅ๋ฐ”๊ตฌ๋‹ˆ ์ •๋ณด๊ฐ€ ํ•ญ์ƒ ๋ณด์ด๋„๋ก ํ•  ์ˆ˜ ์žˆ์–ด ์‚ฌ์šฉ์„ฑ์ด ๊ฐœ์„ ๋  ๊ฒƒ ๊ฐ™์•„์š”!

Suggested change
<nav className="fix top-0 bg-blue-900 text-white flex items-center justify-between w-full h-[50px]">
<nav className="fixed top-0 bg-blue-900 text-white flex items-center justify-between w-full h-[50px]">

Comment on lines +8 to +22
const container = document.getElementById('root')

if (container) {
const root = createRoot(container)

root.render(
<Provider store={store}>
<App />
</Provider>,
)
}else {
throw new Error(
"Root element with ID 'root' was not found in the document. Ensure there is a corresponding HTML element with the ID 'root' in your HTML file.",
)
}
Copy link
Member

Choose a reason for hiding this comment

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

ํ˜„์žฌ ๋ฏธ์…˜ 3์˜ main.tsx ์—์„œ Redux์˜ Provider๋กœ ๊ฐ์‹ธ๊ณ  ์žˆ๋Š”๋ฐ, ๋ฏธ์…˜ 3์—์„œ๋Š” Zustand๋กœ ์ƒํƒœ ๊ด€๋ฆฌ๋ฅผ ์ „ํ™˜ํ–ˆ๊ธฐ ๋•Œ๋ฌธ์— ์ด ๋ถ€๋ถ„์€ ์ œ๊ฑฐํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๋˜ํ•œ, store ๋ฐ slice ๋“ฑ Redux ๊ด€๋ จ ํŒŒ์ผ๋“ค๋„ ์—ฌ์ „ํžˆ ๋‚จ์•„์žˆ๋Š”๋ฐ, ํ”„๋กœ์ ํŠธ ๊ตฌ์กฐ๋ฅผ ๋ช…ํ™•ํ•˜๊ฒŒ ํ•˜๊ธฐ ์œ„ํ•ด ํ•ด๋‹น ํŒŒ์ผ๋“ค๋„ ์ œ๊ฑฐํ•˜๋Š” ๊ฒƒ์„ ๊ถŒ์žฅํ•ฉ๋‹ˆ๋‹ค!

@joyeeon joyeeon merged commit c0817d5 into main May 31, 2025
1 check passed
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