์ „์ฒด ๊ธ€

๐Ÿ‘ฉ‍๐Ÿ’ป java, mysql, android, php, javascript๋ฅผ ๋‹ค๋ฃน๋‹ˆ๋‹ค
ยท React
๋ฉ”์ธ ํ”„๋กœ์ ํŠธ์—์„œ ํ…œํ”Œ๋ฆฟ์„ ์‚ฌ์šฉํ• ๋•Œ, ์™œ ์‚ฌ์šฉํ•˜๋Š”์ง€ ์ •๋ฆฌํ•˜๋Š” ์ค‘์— ์•Œ๊ฒŒ ๋œ ์‚ฌ์‹ค์ด๋‹ค. ์™œ fetch ๋ณด๋‹ค axios๋ฅผ ์“ฐ๋Š” ๊ฒƒ์ด ์ข‹์„๊นŒ? axios์™€ fetch๋Š” ๋ชจ๋‘ HTTP ์š”์ฒญ์„ ๋ณด๋‚ด๋Š” ๋ฐ ์‚ฌ์šฉ๋˜๋Š” ๋„๊ตฌ์ž…๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ axios๋Š” fetch๋ณด๋‹ค ํŽธ๋ฆฌํ•œ API์™€ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•˜๋ฉฐ, ํ”„๋กœ๋ฏธ์Šค ๊ธฐ๋ฐ˜์œผ๋กœ ๋น„๋™๊ธฐ ์ž‘์—…์„ ์ฒ˜๋ฆฌํ•˜๋Š” ๋ฐ ์žˆ์–ด์„œ ๋” ์ง๊ด€์ ์ด๊ณ  ํŽธ๋ฆฌํ•œ ๋ฐฉ๋ฒ•์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ์•„๋ž˜ ์˜ˆ์‹œ ์ฝ”๋“œ๋ฅผ ํ†ตํ•ด axios๊ฐ€ fetch๋ณด๋‹ค ์–ด๋–ป๊ฒŒ ํŽธ๋ฆฌํ•œ์ง€ ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. 1. GET ์š”์ฒญ axios๋กœ GET ์š”์ฒญ์„ ๋ณด๋‚ด๋Š” ์˜ˆ์‹œ ์ฝ”๋“œ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค: axios.get('/api/users') .then(response => { // ์‘๋‹ต ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ console.log(response.data); }) .catch(..
Pre-project 44๊ธฐ ์‚ผ๋•ก์˜ค๋ฒ„ํ”Œ๋กœ์šฐ ํŒ€ ๊นƒํ—ˆ๋ธŒ: https://github.com/codestates-seb/seb44_pre_033 ๋…ธ์…˜: https://www.notion.so/codestates/f93bef9f78744dc8a362e8e58f22a005 ํ”ผ๊ทธ๋งˆ: https://www.figma.com/file/rZQ9dlYffNx9ynTCKaqPtC/pre_project_033?type=design&node-id=2%3A19&mode=design&t=94ODJ6UaRZwP6CFm-1 ์š”์•ฝํšŒ๊ณ  1. api ๋ช…์„ธ์„œ (์–ด๋–ค ๋ฐ์ดํ„ฐ๊ฐ€ ์–ด๋””์— ์“ฐ์ผ๊ฒƒ์ธ์ง€, ์–ด๋–ค ๋ฐ์ดํ„ฐ๋ฅผ ์–ด๋–ป๊ฒŒ ์ €์žฅํ• ๊ฑด์ง€, ์–ด๋–ป๊ฒŒ ๊ฐ€์ ธ์˜ฌ์ง€) ๊ธฐํš์ด ์ค‘์š”ํ•˜๊ตฌ๋‚˜... api ๋ช…์„ธ์„œ๋ฅผ ์ž์„ธํ•˜๊ฒŒ ์ ์–ด์•ผ ํ•˜๋Š”๊ตฌ๋‚˜ swagger api ๋ฌธ์„œํ™” h..
json ์„œ๋ฒ„ ์„ค์น˜์™€ ์—ฌ๋Š”๋ฐฉ๋ฒ• https://www.npmjs.com/package/json-server json-server Get a full fake REST API with zero coding in less than 30 seconds. Latest version: 0.17.3, last published: 3 months ago. Start using json-server in your project by running `npm i json-server`. There are 316 other projects in the npm registry using json-ser www.npmjs.com npm install -g json-server npx json-server --watch posts..
ยท React
์ด๋ฏธ json server์— ์žˆ๋Š” ์œ ์ €์ •๋ณด๋ผ, ๊ฐ€์ž…์ด ๋ถˆ๊ฐ€๋Šฅํ•œ ์ž…๋ ฅ๊ฐ’์ธ ๋ฐ๋„ ํŽ˜์ด์ง€๊ฐ€ ๋„˜์–ด๊ฐ€๋Š” ๋ฌธ์ œ๊ฐ€ ์ƒ๊ฒผ๋‹ค ์ด๋ฏธ ์กด์žฌํ•˜๋Š” ์ด๋ฉ”์ผ ๋น„๋ฒˆ ์ž…๋ ฅํ•˜๋ฉด ์—๋Ÿฌ๋ฉ”์„ธ์ง€๊ฐ€ ๋ณ€๊ฒฝ๋˜์–ด์•ผ ํ•˜๋Š”๋ฐ, ๋ณ€๊ฒฝ์•ˆ๋˜๊ณ  ์ดˆ๊ธฐ ์ƒํƒœ๋กœ ์žˆ๋Š”๊ฒŒ ๋ฌธ์ œ์˜€๋‹ค. Navigate๋ฅผ ์•ˆ๋„ฃ์œผ๋ฉด, ์—๋Ÿฌ๋ฉ”์„ธ์ง€๋Š” ๋ณ€๊ฒฝ๋˜๊ณ  ํŽ˜์ด์ง€๋Š” ์•ˆ๋„˜์–ด๊ฐ„๋‹ค. Navigate ๋ฅผ ๋„ฃ์œผ๋ฉด, ์—๋Ÿฌ๋ฉ”์„ธ์ง€ ๋ณ€๊ฒฝ ์•ˆ๋˜๊ณ  ํŽ˜์ด์ง€๋Š” ๋„˜์–ด๊ฐ„๋‹ค. ์ด์œ ๋Š” ์—๋Ÿฌ๋ฉ”์„ธ์ง€ ๋ณ€๊ฒฝ์€ state๋กœ ๊ด€๋ฆฌํ•˜๊ธฐ ๋•Œ๋ฌธ์—, ๋น„๋™๊ธฐ์ ์œผ๋กœ ์‹คํ–‰๋œ๋‹ค. ์ฆ‰, Navigate๋ณด๋‹ค ์—๋Ÿฌ๋ฉ”์„ธ์ง€ ๋ณ€๊ฒฝ์ด ๋Šฆ๊ฒŒ ์‹คํ–‰๋œ๋‹ค. ๊ทธ๋ž˜์„œ ๋ฐ”๋กœ ํด๋ฆญ์„ ๋ˆ„๋ฅด์ž๋งˆ์ž (์—๋Ÿฌ๋ฉ”์„ธ์ง€ ๋ณ€๊ฒฝ์—†์ด) ํŽ˜์ด์ง€๊ฐ€ ๋„˜์–ด๊ฐ€๋Š” ๊ฒƒ์ด์—ˆ๋‹ค ๊ณ ๋ฏผ์„ ๋งŽ์ด ํ–ˆ๋Š”๋ฐ ํŒ€์›๋ถ„์ด ๊ฐ™์ด ๊ณ ๋ฏผํ•ด์„œ ํ•ด๊ฒฐ์„ ํ•ด์ฃผ์…จ๋‹ค !! (์ง์ง) ํ•ด๊ฒฐ ==> ์ง„์†”๋‹˜! useStateํ›…์œผ๋กœ ๋ณ€๊ฒฝ๋˜๋Š” ๊ฐ’๋“ค์€ ..
๋Œ€ํ‘œ์ ์ธ ํ† ํฐ ๊ธฐ๋ฐ˜ ์ธ์ฆ๊ธฐ์ˆ ๋กœ๋Š” JWT ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. JWT (JSON Web Token) ๋ฐ์ดํ„ฐ ์ „์†ก์— ์‚ฌ์šฉํ•˜๋Š” ๋Œ€ํ‘œ์ ์ธ ํ† ํฐ๊ธฐ๋ฐ˜ ์ธ์ฆ๊ธฐ์ˆ ๋กœ, JSON ํ˜•์‹์œผ๋กœ ์ €์žฅํ•œ ์ •๋ณด(payload)๋ฅผ ์•”ํ˜ธํ™”(์„œ๋ช…)ํ•˜์—ฌ ์ „์†กํ•ฉ๋‹ˆ๋‹ค. ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์„œ๋ฒ„์— ์š”์ฒญ์„ ๋ณด๋‚ผ๋•Œ ์ธ์ฆ์ •๋ณด๋ฅผ ์•”ํ˜ธํ™”๋œ JWT ํ† ํฐ์œผ๋กœ ์ œ๊ณตํ•˜๊ณ , ์„œ๋ฒ„๋Š” ์ด ํ† ํฐ์„ ๊ฒ€์ฆํ•˜์—ฌ ์ธ์ฆ์ •๋ณด๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. JWT์˜ ๊ตฌ์„ฑ์š”์†Œ JWT๋Š” ์–ด๋–ป๊ฒŒ ํ† ํฐ์„ ์•”ํ˜ธํ™”ํ•˜๊ณ  ์ด๋ฅผ ๊ฒ€์ฆํ•˜๋Š” ์ง€ ์•Œ์•„๋ด…์‹œ๋‹ค JWT ๊ธฐ์ˆ ๋กœ ๋งŒ๋“  ํ† ํฐ์€ ๋ณดํ†ต ๋‹ค์Œ๊ณผ ๊ฐ™์€ ํ˜•์‹์˜ ๋ฌธ์ž์—ด๋กœ ์ด๋ฃจ์–ด์ง‘๋‹ˆ๋‹ค ์—ฌ๊ธฐ์—์„œ ์ (.)์ด ์ฐํžŒ ๋ถ€๋ถ„์„ ๊ธฐ์ค€์œผ๋กœ ํ—ค๋”(Header) , ํŽ˜์ด๋กœ๋“œ(Payload), ์‹œ๊ทธ๋‹ˆ์ณ(Signiture) ์ด๋ ‡๊ฒŒ 3๋ถ€๋ถ„์œผ๋กœ ๋‚˜๋‰ฉ๋‹ˆ๋‹ค ํ—ค๋”(Header) ๊ฐ€์žฅ ์•ž์— ์œ„์น˜ํ•œ ํ—ค๋”์—๋Š” ๋งˆ..
์„ธ์…˜์ด๋ž€ ์‚ฌ์šฉ์ž๊ฐ€ ์ธ์ฆ์— ์„ฑ๊ณตํ•œ ์ƒํƒœ๋ฅผ ๋งํ•˜๊ณ , ํ† ํฐ์ด๋ž€ ๊ตํ†ต์Šน์ฐจ๊ถŒ๊ณผ ๊ฐ™์ด, ๋ฌด์–ธ๊ฐ€๋ฅผ ์ด์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๊ถŒํ•œ์ด๋‚˜ ์ž๊ฒฉ์„ ๋‚˜ํƒ€๋‚ด๋Š” ์ง•ํ‘œ์ž…๋‹ˆ๋‹ค ํ† ํฐ ๊ธฐ๋ฐ˜ ์ธ์ฆ๋ฐฉ์‹์€ ์„ธ์…˜ ๊ธฐ๋ฐ˜ ์ธ์ฆ์ด ๊ฐ€์ง€๊ณ  ์žˆ๋˜ ํ•œ๊ณ„๋ฅผ ๊ทน๋ณตํ•˜๊ณ ์ž ๋งŒ๋“ค์–ด์กŒ์Šต๋‹ˆ๋‹ค. ์„ธ์…˜ ๊ธฐ๋ฐ˜์ธ์ฆ์€ ์„œ๋ฒ„์—์„œ ์œ ์ €์˜ ์ƒํƒœ๋ฅผ ๊ด€๋ฆฌํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ ๊ฐœ๋ฐœ์ž๋“ค์€ ์„œ๋ฒ„์˜ ๋ถ€๋‹ด์„ ์ค„์ด๊ธฐ ์œ„ํ•ด์„œ, ์„œ๋ฒ„์— ์‚ฌ์šฉ์ž์˜ ์ธ์ฆ์ƒํƒœ๋ฅผ ์ €์žฅํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹Œ ํด๋ผ์ด์–ธํŠธ์— ์ด๋ฅผ ์ €์žฅํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ๊ณ ์•ˆํ•˜์˜€๊ณ , ๊ทธ๊ฒŒ ๋ฐ”๋กœ ํ† ํฐ์ž…๋‹ˆ๋‹ค. ์„ธ์…˜ ๊ธฐ๋ฐ˜ ์ธ์ฆ๋ฐฉ์‹ ๋จผ์ €, ํ† ํฐ ๊ธฐ๋ฐ˜ ์ธ์ฆ๋ฐฉ์‹์ด ์ƒ๊ฒจ๋‚œ ๋ฐฐ๊ฒฝ์ธ, ์„ธ์…˜ ๊ธฐ๋ฐ˜ ์ธ์ฆ์— ๋Œ€ํ•œ ๊ฐ„๋‹จํ•˜๊ฒŒ ์•Œ์•„๋ณผ๊นŒ์š”? 1. ์œ ์ €๊ฐ€ ์ธ์ฆ์ •๋ณด๋ฅผ ๋‹ด์•„ ์„œ๋ฒ„์— ๋กœ๊ทธ์ธ ์š”์ฒญ์„ ๋ณด๋ƒ…๋‹ˆ๋‹ค 2. ์„œ๋ฒ„๋Š” ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ์ €์žฅ๋œ ์œ ์ €์˜ ์ธ์ฆ์ •๋ณด๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค 3. ์ธ์ฆ์— ์„ฑ๊ณตํ–ˆ๋‹ค๋ฉด, ํ•ด๋‹น ์œ ์ €์— ๋Œ€ํ•œ..
ยท Github
๋‚˜์ค‘์— ๋” ์ถ”๊ฐ€์˜ˆ์ •
ยท React
ํ˜„์žฌ useReducer๋กœ ๋งŒ๋“  ํ”„๋กœ์ ํŠธ๋ฅผ ์ค‘์•™ ์ง‘์ค‘์  ์ „์—ญ์ƒํƒœ ๊ด€๋ฆฌ๋ฅผ ์œ„ํ•ด RTK์œผ๋กœ ๋ฆฌํŒฉํ† ๋งํ•˜๋Š” ์ค‘์ด๋‹ค. (์“ฐ์ด๋Š” ์šฉ์–ด๋Š” ๋น„์Šค๋ฌด๋ฆฌ ํ•˜์ง€๋งŒ, ๋‹ค๋ฅธ ์ ์ด ์žˆ์–ด์„œ ๋ฆฌํŒฉํ† ๋ง ํ•˜๋ฉด์„œ ๋ฐฐ์šฐ๋Š”์ค‘~) ๊ทธ๋Ÿฐ๋ฐ, Components์— ๋ณด์ด๋Š” ๊ฒƒ์ฒ˜๋Ÿผ TodoCard(-TodoItem) , CompletedCard(-CompletedItem) ๊ฐ๊ฐ ์ปดํฌ๋„ŒํŠธ๋ฅผ ๋งŒ๋“ค์—ˆ์Œ์—๋„ ๋ถˆ๊ตฌํ•˜๊ณ , ๋ฌธ์ œ๊ฐ€ ์ƒ๊ฒผ๋‹ค. TodoCard์˜ ๋ชจ๋‹ฌ์ฐฝ์„ ์—ด์–ด์„œ ์ •๋ณด๋ฅผ ์ž…๋ ฅํ•˜๋ฉด, CompletedCard ์•„๋ž˜์— ๋ฉ”๋ชจ๊ฐ€ ๋ˆ„์ ๋œ๋‹ค๋Š” ์ ์ด๋‹ค. ํƒ€๊ฒŸ์ด ์ž˜๋ชป๋˜์—ˆ๋‚˜ ์‹ถ์–ด import์™€ export ๋“ฑ์„ ํ™•์ธํ–ˆ์ง€๋งŒ, ๊ฒฝ๋กœ ๋ฌธ์ œ๋Š” ์—†์—ˆ๊ณ , ์˜คํƒ€์˜ ๋ฌธ์ œ๋„ ์•„๋‹ˆ์—ˆ๋‹ค... ๋ฐ๋ธŒํˆด์„ ๋ด๋„, ์ž๊พธ modalCompletedItem์ด ์—…๋ฐ์ดํŠธ ๋˜๋Š” ์ƒํ™ฉ์ด๋‹ค... const He..
becky(์ง€์€)
Know yourself, follow your passion