[๐Ÿ’๐Ÿป‍โ™€๏ธ mbti ํ…Œ์ŠคํŠธ ๋งŒ๋“ค๊ธฐ] ํ† ํฐ ๋งŒ๋ฃŒ ์ด์Šˆ... ๐Ÿ˜ต‍๐Ÿ’ซ

ํ”„๋กœ์ ํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๋˜ ์ค‘ ํ”„๋กœํ•„ ์กฐํšŒ์—์„œ ๊ฐ‘์ž๊ธฐ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค.  ์˜ค๋ฅ˜๋„คํŠธ์›Œํฌ ํƒญ์—์„œ ํ™•์ธํ•œ ์˜ค๋ฅ˜ ์›์ธ์€ ํ† ํฐ ๋งŒ๋ฃŒ ์ด์Šˆ..!  ํ† ํฐ ๋งŒ๋ฃŒ ์‹œ๊ฐ„์„ ํ™•์ธํ•ด ๋ณด๋‹ˆ.. 1์‹œ๊ฐ„์ธ ๊ฒƒ์„ ํ™•์ธํ–ˆ๋‹ค...  ํ•ด๊ฒฐ ๊ณผ์ •...์šฐ์„  ๋น ๋ฅธ ํ…Œ์ŠคํŠธ๋ฅผ ์œ„ํ•ด ํ† ํฐ์„ 1๋ถ„์งœ๋ฆฌ ๋ฐœ๊ธ‰ํ•˜๋„๋ก ํ–ˆ๋‹ค.export const login = async (userData) => { return await authInstance.post("/login?expiresIn=1m", userData);}; ์ฒ˜์Œ ์ƒ๊ฐํ•œ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์€ ์‘๋‹ต์ด status ๊ฐ€ 401 ์ธ ๊ฒฝ์šฐ ๋กœ๊ทธ์•„์›ƒ ์ฒ˜๋ฆฌํ•˜๊ณ  ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋กœ ๋Œ๋ฆฌ๋ฉด ๋˜๊ฒ ์ง€ ํ–ˆ๋Š”๋ฐ, ๋‹ค๋ฅธ ์˜ค๋ฅ˜๋„ ๋‹ค 401์„ ์ฃผ๊ณ  ์žˆ์—ˆ๋‹ค.๊ทธ๋Ÿฌ๋ฉด ์‘๋‹ต์œผ๋กœ "ํ† ํฐ์ด ๋งŒ๋ฃŒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๋‹ค์‹œ ๋กœ๊ทธ์ธ ํ•ด์ฃผ์„ธ์š”." ๋ผ๋Š” ๋ฉ”์„ธ์ง€๋ฅผ ์ฃผ๊ณ  ์žˆ์œผ..

[๐Ÿ ํฌ์ผ“๋ชฌ ๋„๊ฐ ๋งŒ๋“ค๊ธฐ][๊ฐœ์ธ] Context API ์‚ฌ์šฉํ•ด์„œ ๋ฆฌํŒฉํ† ๋งํ•˜๊ธฐ

props drilling ๋ฐฉ์‹์œผ๋กœ ๊ตฌํ˜„ํ•œ ์ฝ”๋“œ๋ฅผ Context ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ฆฌํŒฉํ† ๋งํ•ด ๋ณด๋ ค ํ•œ๋‹ค.  Context API ์‚ฌ์šฉ ์ „ ๊ตฌ์กฐ์•„๋ž˜ ์ด๋ฏธ์ง€๋Š” ๋ฆฌํŒฉํ† ๋ง ์ „ props drilling ๋ฐฉ์‹์œผ๋กœ ๊ตฌํ˜„ํ•œ ์ปดํฌ๋„ŒํŠธ ๊ตฌ์กฐ์ด๋‹ค.  Dashboard ์—์„œ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š” removedPokemon ์„ PokemonCard ๋ฅผ ์œ„ํ•ด์„œ props ๋กœ ์ „๋‹ฌํ•ด ์ฃผ๊ณ  ์žˆ๋‹ค. ๋˜ํ•œ PokemonList ์—์„œ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š” addPokemon ์„ props ๋กœ ์ „๋‹ฌํ•ด ์ฃผ๊ณ  ์žˆ๋‹ค. ์ด ํ”„๋กœ์ ํŠธ๋Š” ๊ฐ„๋‹จํ•œ ๊ตฌ์กฐ๋กœ ๋˜์–ด์žˆ์–ด์„œ ์ถฉ๋ถ„ํžˆ props drilling ๋ฐฉ์‹์œผ๋กœ ํ•„์š”ํ•œ ์ •๋ณด๋ฅผ ์ „๋‹ฌํ•ด ์ค˜๋„ ๊ดœ์ฐฎ๊ฒ ์ง€๋งŒ ๋งŒ์•ฝ ์ปดํฌ๋„ŒํŠธ๊ฐ€ ๋ช‡๋ฐฑ ๊ฐœ ๋˜๋ฉด props ๋ฅผ ์ „๋‹ฌ ์ „๋‹ฌ ์ „๋‹ฌ.... ํ•ด์•ผ๋  ๊ฒƒ์ด๋‹ค. ์ด๋ฅผ ํ•ด์†Œํ•˜๊ธฐ ์œ„ํ•ด Context ๋ฅผ ์‚ฌ์šฉํ•ด..

[๐Ÿ ํฌ์ผ“๋ชฌ ๋„๊ฐ ๋งŒ๋“ค๊ธฐ][๊ฐœ์ธ] ๋Œ€์‹œ๋ณด๋“œ ๋ Œ๋”๋ง ๋ฐฉ๋ฒ•์— ๋Œ€ํ•œ ๊ณ ๋ฏผ

์ฃผ์–ด์ง„ ํฌ์ผ“๋ชฌ ์ค‘์—์„œ ์›ํ•˜๋Š” ํฌ์ผ“๋ชฌ์„ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ๋Š” ํ”„๋กœ์ ํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๊ณ  ์žˆ๋‹ค. ํฌ์ผ“๋ชฌ์€ ์ด 6๊ฐœ๋ฅผ ์„ ํƒํ•  ์ˆ˜ ์žˆ๊ณ  ํฌ์ผ“๋ชฌ 3๊ฐœ๋ฅผ ์„ ํƒํ–ˆ์œผ๋ฉด 3๊ฐœ์˜ ํฌ์ผ“๋ชฌ์ด ๋ณด์ด๊ณ  ์„ ํƒํ•˜์ง€ ์•Š์€ 3๊ฐœ๋Š” ๊ธฐ๋ณธ ์ด๋ฏธ์ง€๊ฐ€ ๋ณด์—ฌ์•ผ ํ•œ๋‹ค. ์„ ํƒํ•œ 3๊ฐœ์™€ ์„ ํƒํ•˜์ง€ ์•Š์€ ๊ธฐ๋ณธ ์ด๋ฏธ์ง€๊ฐ€ ํ•œ ๋ฒˆ์— ๋ Œ๋”๋ง์ด ์ด๋ฃจ์–ด์ ธ์•ผ ํ•˜๋Š”๋ฐ, ์ด ๋ Œ๋”๋ง ๋ฐฉ์‹์„ ์–ด๋–ป๊ฒŒ ํ•ด์ฃผ์–ด์•ผ ํ• ์ง€ ๊ณ ๋ฏผํ•œ ๊ฒƒ์„ ์ •๋ฆฌํ•ด ๋ณด๋ ค๊ณ  ํ•œ๋‹ค. ์ฒ˜์Œ ์ ‘๊ทผ ๋ฐฉ์‹๊ณผ ์ด์Šˆ์ฒ˜์Œ ์ƒ๊ฐํ•œ ๋ฐฉ์‹์€ useState ์ดˆ๊ธฐํ™”๋ฅผ ํฌ๊ธฐ๊ฐ€ 6์ธ ๋ฐฐ์—ด๋กœ ๋งŒ๋“ค์–ด๋ฒ„๋ฆฌ๊ธฐ ์•„๋ž˜์™€ ๊ฐ™์ด ๊ฐ๊ฐ์˜ ์š”์†Œ๋ฅผ null ๋กœ ์ดˆ๊ธฐํ™”ํ•œ ํฌ๊ธฐ๊ฐ€ 6์ธ ๋ฐฐ์—ด์„ useState ๋กœ ์„ค์ •ํ•˜์˜€๋‹ค. (๋‹น์‹œ์—” ์ด๊ฒŒ ์ตœ์„ ์ด๋ผ๊ณ  ์ƒ๊ฐํ•จ)ํ•˜์ง€๋งŒ ์ด๋ ‡๊ฒŒ ํ•ด๋ฒ„๋ฆฌ๋‹ˆ๊นŒ ์‚ฌ์†Œํ•œ ๋ฌธ์ œ์ ๋“ค์ด ๋ฐœ์ƒํ•˜๊ธฐ ์‹œ์ž‘ํ–ˆ๋‹ค. ๐Ÿ˜‡ const [selectedPokemon, s..

[๐ŸŽฌ ์˜ํ™” ๊ฒ€์ƒ‰ ์‚ฌ์ดํŠธ ๋งŒ๋“ค๊ธฐ][ํŒ€] ์˜ํ™” ๊ฒ€์ƒ‰ ์‚ฌ์ดํŠธ ํŒ€ ํ”„๋กœ์ ํŠธ ํšŒ๊ณ 

๋‚ด์ผ๋ฐฐ์›€์บ ํ”„์—์„œ ์ง„ํ–‰ํ•œ ๋‘ ๋ฒˆ์งธ ํŒ€ ํ”„๋กœ์ ํŠธ๊ฐ€ ๋๋‚ฌ๋‹ค. ์ด๋ฒˆ ํ”„๋กœ์ ํŠธ๋Š” ๊ฐœ์ธํ”„๋กœ์ ํŠธ๋กœ ์ง„ํ–‰ํ–ˆ๋˜ ์˜ํ™” ๊ฒ€์ƒ‰ ์‚ฌ์ดํŠธ๋ฅผ ๊ณ ๋„ํ™”ํ•˜๋Š” ๊ฒƒ์ด์—ˆ๋‹ค. ์ด๋ฒˆ ํ”„๋กœ์ ํŠธ๋กœ ๋ฐฐ์šด ๊ฒƒ์ด ๋งŽ๊ธฐ์— ์˜ค๋Š˜๋„ KTP ํšŒ๊ณ ๋ฅผ ์ž‘์„ฑํ•ด ๋ณด๋ ค ํ•œ๋‹ค. ๐Ÿฅณ ํ”„๋กœ์ ํŠธ ๊ฒฐ๊ณผ๋ฌผ  ๋ฐฐํฌ ๋งํฌ๋ฐฐํฌ๋งํฌ๊นƒํ—ˆ๋ธŒ ์ฃผ์†Œ Keep์ง€๋‚œ๋ฒˆ ํŒ€ํ”„๋กœ์ ํŠธ ์—์„œ ์•„์‰ฌ์› ๋˜ ๋ถ€๋ถ„์„ ๋ถ„์„ํ•ด์„œ ์ด๋ฒˆ ํ”„๋กœ์ ํŠธ์—์„œ๋Š” ๋ณด์™„ํ•˜์—ฌ ์ง„ํ–‰ํ–ˆ๋‹ค. ์ฒซ ๋ฒˆ์งธ, ํ”„๋กœ์ ํŠธ ํ™˜๊ฒฝ ๊ตฌ์„ฑ์„ ๋ฏธ๋ฆฌ ์ •ํ•˜๊ณ  ์ง„ํ–‰ํ•œ ์ ์ด ์ข‹์•˜๋‹ค. ์ง€๋‚œ๋ฒˆ์—๋Š” ํ”„๋กœ์ ํŠธ ํด๋” ๊ตฌ์กฐ์™€ ์ฝ”๋”ฉ์ปจ๋ฒค์…˜ ๋“ฑ์„ ์ •ํ•ด๋‘์ง€ ์•Š์•˜์—ˆ๋‹ค. ์ด ๋ถ€๋ถ„์„ ์ด๋ฒˆ ํŒ€ ํ”„๋กœ์ ํŠธ์—์„œ๋Š” ํŒ€์›๋ถ„๋“ค๊ณผ ๊ฐœ๋ฐœ ์‹œ์ž‘ ์ „์— ๋จผ์ € ์ƒ์˜ํ•˜๊ณ  ๊ตฌ์กฐ๋ฅผ ์žก์•„๋‘๊ณ  ์ง„ํ–‰ํ–ˆ๋‹ค. ํ™•์‹คํžˆ ์ด๋ ‡๊ฒŒ ํ•˜๋‹ˆ๊นŒ ํ”„๋กœ์ ํŠธ ๊ตฌ์กฐ๊ฐ€ ํ•œ๋ˆˆ์— ๋ณด์—ฌ์„œ ํŒŒ์ผ ์ฐพ๊ธฐ๋„ ์‰ฌ์› ๊ณ , ๊ฐ ํด๋”์™€ ํŒŒ์ผ์ด ์–ด๋–ค ์—ญํ• ์„ ํ•˜๋Š”์ง€ ๋ช…ํ™•ํ•˜๊ฒŒ..

[๐ŸŽฌ ์˜ํ™” ๊ฒ€์ƒ‰ ์‚ฌ์ดํŠธ ๋งŒ๋“ค๊ธฐ][ํŒ€] ์˜ํ™” ๊ฒ€์ƒ‰ ์‚ฌ์ดํŠธ ๋งŒ๋“ค๊ธฐ ๊ฐœ๋ฐœ ๊ธฐ๋ก

์˜ํ™” ๊ฒ€์ƒ‰ ์‚ฌ์ดํŠธ๋ฅผ ๊ฐœ๋ฐœํ•˜๋ฉด์„œ ๋ฐœ์ƒํ–ˆ๋˜ ์†Œ์†Œํ•œ ์ด์Šˆ์™€ ํ•ด๊ฒฐ๋ฐฉ๋ฒ•๋“ค์„ ์ •๋ฆฌํ•ด๋ณด๋ คํ•œ๋‹ค.  ๋ฆฌ๋ทฐ ์ด์Šˆ์ƒˆ๋กœ๊ณ ์นจ ๋“ฑ๋ก, ์‚ญ์ œ, ์ˆ˜์ •์„ ํ•  ๋•Œ ๋ณ€๊ฒฝ ์‚ฌํ•ญ์„ ๋ฐ˜์˜ํ•˜๊ธฐ ์œ„ํ•ด์„œ ํ™”๋ฉด์„ ์ƒˆ๋กœ๊ณ ์นจํ•˜๋„๋ก ํ–ˆ๋‹ค.  ์•„๋ž˜๋Š” ์ˆ˜์ • ๋ฒ„ํŠผ ํด๋ฆญ์Šค ๋ฐœ์ƒํ•˜๋Š” ์ด๋ฒคํŠธ์ด๋‹ค. ์ˆ˜์ •์ด ์™„๋ฃŒ๋œ ํ›„ ์ƒˆ๋กœ๊ณ ์นจ์„ ํ•˜์—ฌ ๋ณ€๊ฒฝ๋œ ๋ฐ์ดํ„ฐ๋ฅผ ๋ณด์ด๋„๋ก ํ–ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ๋„ˆ๋ฌด ๋Œ€๋†“๊ณ  ๊นœ๋นก์ด๋Š” ํ˜„์ƒ์ด ๋ณด๊ธฐ ๋ถˆํŽธํ•ด์„œ ๋‹ค๋ฅธ ๋ฐฉ๋ฒ•์ด ์žˆ๋‚˜ ๊ณ ๋ฏผํ•˜๋˜ ์ค‘, DOM ์„ ์ง์ ‘ ์ˆ˜์ •ํ•˜์—ฌ ๋ณ€๊ฒฝ ์‚ฌํ•ญ์„ ์ €์žฅํ•˜๋Š” ๋ฐฉ๋ฒ•์ด ์žˆ๋Š” ๊ฒƒ์„ ์•Œ์•˜๋‹ค.saveUpdateButton.addEventListener('click', async () => { if (window.confirm('์ •๋ง๋กœ ์ด ๋ฆฌ๋ทฐ๋ฅผ ์ˆ˜์ •ํ•˜์‹œ๊ฒ ์Šต๋‹ˆ๊นŒ?')) { const updatedContent = reviewItem.que..

์ตœ๊ทผ์— ์˜ฌ๋ผ์˜จ ๊ธ€
Total
Today
Yesterday
๋งํฌ