Skip to content

edhcoding/Fandom-k

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Fandom-k

์†Œ๊ฐœ ๋ฐ ๊ฐœ์š”

  • ํ”„๋กœ์ ํŠธ ๊ธฐ๊ฐ„: 2024.04.30 ~ 2024.05.17
  • ๋ฐฐํฌ URL: ๐Ÿ”— Fandom-K

[ํ”„๋กœ์ ํŠธ ์„ค๋ช…]

  • 'Fandom-K'๋Š” ์•„์ด๋Œ ์กฐ๊ณต ํ”Œ๋žซํผ์ž…๋‹ˆ๋‹ค.
  • ํฌ๋ ˆ๋”ง์„ ์ถฉ์ „ํ•˜์—ฌ ์•„์ด๋Œ์—๊ฒŒ ํ›„์›๊ณผ ์ธ๊ธฐ ํˆฌํ‘œ๋ฅผ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ๋ชจ๊ธˆ๋œ ํฌ๋ ˆ๋”ง๊ณผ ์•„์ด๋Œ ์ธ๊ธฐ ์ˆœ์œ„๋ฅผ ์‹ค์‹œ๊ฐ„์œผ๋กœ ํ™•์ธ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ๊ด€์‹ฌ์žˆ๋Š” ์•„์ด๋Œ์„ ๋งˆ์ดํŽ˜์ด์ง€์—์„œ ํŒ”๋กœ์ž‰ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
๋ชฉ์ฐจ

1. ํŒ€ ์†Œ๊ฐœ

๐Ÿ‘‘ ์†Œํ˜œ๋ฆฐ ๐Ÿ“œ ์€๋™ํ˜ ๐Ÿ’ป ์ฒœ๊ถŒํฌ ๐ŸŽจ ์ด์œจ
blog: Rynn
github: miraclee1226
blog: Eun_Frontend
github: edhcoding
blog: alexgoni
github: alexgoni
github: yulrang

2. ๊ธฐ์ˆ  ๋ฐ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ

[์‚ฌ์šฉ ๊ธฐ์ˆ ]

[๊ฐœ๋ฐœ ํ™˜๊ฒฝ]

  • GitHub Projects: ์ง„ํ–‰ ์ƒํ™ฉ์„ ๊ณต์œ ํ•˜๊ณ ์ž GitHub Issues์—์„œ ๊ฐ์ž ๋งก์€ ์—…๋ฌด๋ฅผ ์ด์Šˆ ํ…œํ”Œ๋ฆฟ์— ์ฒดํฌ๋ฆฌ์ŠคํŠธ ํ˜•์‹์œผ๋กœ ๊ณต์œ ํ–ˆ์Šต๋‹ˆ๋‹ค.
  • Figma: ๋””์ž์ธ ์‹œ์•ˆ์„ ์ฐธ๊ณ ํ–ˆ์Šต๋‹ˆ๋‹ค.
  • Discord: ์›ํ™œํ•œ ์˜์‚ฌ์†Œํ†ต์„ ์œ„ํ•ด ๋””์Šค์ฝ”๋“œ์—์„œ ์˜์ƒ ๋ฐ ์Œ์„ฑํ†ตํ™”๋ฅผ ์ ๊ทน ํ™œ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.

[git ํ๋ฆ„ ์ „๋žต]

๊ธฐ๋Šฅ ๋ณ„๋กœ ๋‹ด๋‹นํ•˜์—ฌ ํ”„๋กœ์ ํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๊ณ ์ž Git Flow ๋ฐฉ์‹์„ ์‚ฌ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ธฐ๋Šฅ ๋ณ„ ๋ธŒ๋žœ์น˜๋ฅผ ๋งŒ๋“ค๊ณ  ๊ฐ์ž ์ž‘์—… ๋ธŒ๋žœ์น˜๋ฅผ ๋”ฐ๋กœ ์ƒ์„ฑํ•˜์—ฌ develop ๋ธŒ๋žœ์น˜๋กœ PR ๋ฐ Merge๋ฅผ ์ง„ํ–‰ํ•ฉ๋‹ˆ๋‹ค.

gitflow

[์ปค๋ฐ‹ ์ปจ๋ฒค์…˜]

- Featย : ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒฝ์šฐ
- Fixย : ๋ฒ„๊ทธ๋ฅผ ๊ณ ์นœ๊ฒฝ์šฐ
- Docsย : ๋ฌธ์„œ๋ฅผ ์ˆ˜์ •ํ•œ ๊ฒฝ์šฐ
- Styleย : ์ฝ”๋“œ ํฌ๋งท ๋ณ€๊ฒฝ, ์„ธ๋ฏธ์ฝœ๋ก  ๋ˆ„๋ฝ, ์ฝ”๋“œ ์ˆ˜์ •์ด ์—†๋Š”๊ฒฝ์šฐ
- Refactorย : ์ฝ”๋“œ ๋ฆฌํŽ™ํ† ๋ง
- Testย : ํ…Œ์ŠคํŠธ ์ฝ”๋“œ. ๋ฆฌํŽ™ํ† ๋ง ํ…Œ์ŠคํŠธ ์ฝ”๋“œ๋ฅผ ์ถ”๊ฐ€ํ–ˆ์„ ๋•Œ
- Choreย : ๋นŒ๋“œ ์—…๋ฌด ์ˆ˜์ •, ํŒจํ‚ค์ง€ ๋งค๋‹ˆ์ € ์ˆ˜์ •
- Designย : CSS ๋“ฑ ์‚ฌ์šฉ์ž๊ฐ€ UI ๋””์ž์ธ์„ ๋ณ€๊ฒฝํ–ˆ์„ ๋•Œ
- Renameย : ํŒŒ์ผ๋ช…(or ํด๋”๋ช…) ์„ ์ˆ˜์ •ํ•œ ๊ฒฝ์šฐ
- Removeย : ์ฝ”๋“œ(ํŒŒ์ผ)์„ ์‚ญ์ œํ•œ ๊ฒฝ์šฐ

[์ฝ”๋“œ ์ปจ๋ฒค์…˜]

ํ†ต์ผ์„ฑ ์žˆ๋Š” ์ฝ”๋“œ ์ž‘์„ฑ์„ ์œ„ํ•ด ๋‹ค์–‘ํ•œ ์ฝ”๋“œ ์ปจ๋ฒค์…˜์„ ์ •ํ•ด ์‚ฌ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.

{
  "printWidth": 80,
  "singleQuote": false,
  "jsxSingleQuote": false,
  "tabWidth": 2,
  "semi": true,
  "trailingComma": "all",
  "bracketSpacing": true,
  "arrowParens": "always",
  "endOfLine": "crlf"
}
{
  "extends": ["react-app", "react-app/jest", "naver", "prettier"],
  "rules": {
    "no-console": 1,
    "react-hooks/exhaustive-deps": 0,
    "no-unused-expression": 0,
    "no-unused-vars": "off",
    "react/prop-types": "off",
    "arrow-body-style": "off"
  }
}

[๋ฐฐํฌ ์„œ๋น„์Šค]

3. ๊ฐœ๋ฐœ ๊ธฐ๊ฐ„ ๋ฐ ์ž‘์—… ๋ฌธํ™”

[ํ”„๋กœ์ ํŠธ ๊ธฐ๊ฐ„] : 2024.04.30 ~ 2024.05.17

[์ž‘์—… ๋ฌธํ™”]

โœ… GitHub Project

๊ฐ์ž ๋งก์€ ์—…๋ฌด๋ฅผ ์ด์Šˆ ํ…œํ”Œ๋ฆฟ์— ์ฒดํฌ๋ฆฌ์ŠคํŠธ ํ˜•์‹์œผ๋กœ ๊ณต์œ ํ–ˆ์Šต๋‹ˆ๋‹ค. GitHub Project

โœ… Discord

Discord ์Šค๋ ˆ๋“œ์— ๋ฐ์ผ๋ฆฌ ์Šคํฌ๋Ÿผ ๋‚ด์šฉ์„ ์ •๋ฆฌํ•ด ์—…๋กœ๋“œ ํ–ˆ์Šต๋‹ˆ๋‹ค. Discord

โœ… VSCode Live Share

  • ํŽ˜์–ด ํ”„๋กœ๊ทธ๋ž˜๋ฐ์„ ์ง„ํ–‰ํ•˜๊ฑฐ๋‚˜ ์ „์ฒด ์ƒ์˜๊ฐ€ ํ•„์š”ํ•œ ์ž‘์—…์„ ํ•  ๋•Œ, VSCode์˜ Live Share ํ™•์žฅ ๊ธฐ๋Šฅ์„ ์ ๊ทน ํ™œ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.

4. ์ฃผ์š” ๊ธฐ๋Šฅ

๐Ÿ’ฐ ํฌ๋ ˆ๋”ง ์ถฉ์ „ํ•˜๊ธฐ

  • localStorage

๐ŸŽ ํ›„์›ํ•˜๊ธฐ

  • ํ›„์› ์‹œ ํฌ๋ ˆ๋”ง ์ฐจ๊ฐ

๐Ÿ“Š ํˆฌํ‘œํ•˜๊ธฐ

  • ํˆฌํ‘œ ์‹œ ํฌ๋ ˆ๋”ง ์ฐจ๊ฐ

๐Ÿ™‹ ํ”„๋กœํ•„

  • ๊ด€์‹ฌ์žˆ๋Š” ์•„์ด๋Œ ์ถ”๊ฐ€
  • ๋ฌดํ•œ ์Šคํฌ๋กค

5. ํ”„๋กœ์ ํŠธ ๊ตฌ์กฐ

[ํด๋” ๊ตฌ์กฐ]

  • api/ : ์™ธ๋ถ€ API ํ†ต์‹ 
  • assets/ : ์ด๋ฏธ์ง€, ์•„์ด์ฝ˜
  • components/ : ๊ณตํ†ต ์ปดํฌ๋„ŒํŠธ
  • pages/ : ์ƒ์„ฑํ•œ ์ปดํฌ๋„ŒํŠธ๋“ค์„ ์กฐํ•ฉํ•ด ๊ฐœ๋ณ„ ๊ธฐ๋Šฅ ๊ตฌํ˜„
  • context/ : ์ „์—ญ ์ƒํƒœ ๊ด€๋ฆฌ
  • styles/ : ๊ณตํ†ต ์Šคํƒ€์ผ, reset.scss
  • utils/ : util ํ•จ์ˆ˜
๐Ÿ“ฆsrc
 โ”ฃ ๐Ÿ“‚api
 โ”ฃ ๐Ÿ“‚assets
 โ”ฃ ๐Ÿ“‚components
 โ”ƒ โ”ฃ ๐Ÿ“‚Button
 โ”ƒ โ”ฃ ๐Ÿ“‚Card
 โ”ƒ โ”ฃ ๐Ÿ“‚ChartItem
 โ”ƒ โ”ฃ ๐Ÿ“‚Image
 โ”ƒ โ”ฃ ๐Ÿ“‚Layout
 โ”ƒ โ”ฃ ๐Ÿ“‚Modal
 โ”ƒ โ”ฃ ๐Ÿ“‚Navbar
 โ”ƒ โ”ฃ ๐Ÿ“‚Skeleton
 โ”ƒ โ”ฃ ๐Ÿ“‚Tab
 โ”ƒ โ”ฃ ๐Ÿ“‚TouchArea
 โ”ƒ โ”— ๐Ÿ“‚WebpLoader
 โ”ฃ ๐Ÿ“‚context
 โ”ฃ ๐Ÿ“‚hooks
 โ”ฃ ๐Ÿ“‚pages
 โ”ƒ โ”ฃ ๐Ÿ“‚Landing
 โ”ƒ โ”ฃ ๐Ÿ“‚List
 โ”ƒ โ”— ๐Ÿ“‚MyPage
 โ”ฃ ๐Ÿ“‚styles
 โ”ฃ ๐Ÿ“‚utils
 โ”ฃ ๐Ÿ“œApp.jsx
 โ”— ๐Ÿ“œindex.js

6. ์—ญํ•  ๋ถ„๋‹ด

์—ญํ•  ๋ถ„๋‹ด

7. UI

UI png

8. ํŽ˜์ด์ง€ ๊ธฐ๋Šฅ

1. ๋žœ๋”ฉ ํŽ˜์ด์ง€

์ƒ์„ธ๊ธฐ๋Šฅ
  • '๋กœ๊ณ  ๋ฒ„ํŠผ'์„ ํด๋ฆญํ•˜๋ฉด /ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.
  • '์ง€๊ธˆ ์‹œ์ž‘ํ•˜๊ธฐ' ๋ฒ„ํŠผ์„ ํด๋ฆญ ์‹œ localStorage๋ฅผ ์ดˆ๊ธฐํ™”ํ•˜๊ณ  /list ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.

2. ๋ชฉ๋กํŽ˜์ด์ง€

๋ชฉ๋ก ํŽ˜์ด์ง€์˜ ํ›„์›์„ ๊ธฐ๋‹ค๋ฆฌ๋Š” ์กฐ๊ณต

์ƒ์„ธ๊ธฐ๋Šฅ
  • '๋กœ๊ณ ' ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๋ฉด /list ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค. ( ํ˜„์žฌ๋Š” ์ƒˆ๋กœ ๊ณ ์นจ )
  • ๋‚ด ํฌ๋ ˆ๋”ง์€ localstorage๋กœ ๊ด€๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
  • '์ถฉ์ „ํ•˜๊ธฐ' ๋ฒ„ํŠผ์„ ํด๋ฆญ ์‹œ ์ถฉ์ „ํ•˜๊ธฐ ๋ชจ๋‹ฌ์ฐฝ์ด ๋‚˜ํƒ€๋‚ฉ๋‹ˆ๋‹ค.
  • ์ƒ๋‹จ์˜ ํ”„๋กœํ•„ ์ด๋ฏธ์ง€๋ฅผ ํด๋ฆญ์‹œ /mypage ๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.
  • ํ”„๋กœํ•„ ์ด๋ฏธ์ง€๋Š” ์ž์œ ๋กญ๊ฒŒ ์„ ํƒํ•ด์ฃผ์„ธ์š”.
  • PC์—์„œ ํ›„์›์„ ๊ธฐ๋‹ค๋ฆฌ๋Š” ์กฐ๊ณต ๋ฆฌ์ŠคํŠธ๋Š” ์ขŒ/์šฐ์ธก ๋ฒ„ํŠผ ํด๋ฆญ ์‹œ ๋‹ค์Œ ์ˆœ์„œ์˜ ์กฐ๊ณต ์นด๋“œ๋“ค์ด ๋ณด์ž…๋‹ˆ๋‹ค.
  • PC์—์„œ ํ›„์›์„ ๊ธฐ๋‹ค๋ฆฌ๋Š” ์กฐ๊ณต ๋ฆฌ์ŠคํŠธ ์ฒซ ์ˆœ์„œ์ผ ๋•Œ๋Š” ์ขŒ์ธก ๋ฒ„ํŠผ์ด ๋ณด์ด์ง€ ์•Š๊ณ , ๋งˆ์ง€๋ง‰ ์ˆœ์„œ์ผ ๋•Œ๋Š” ์šฐ์ธก ๋ฒ„ํŠผ์ด ๋ณด์ด์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
  • Tablet์—์„œ ํ›„์›์„ ๊ธฐ๋‹ค๋ฆฌ๋Š” ์กฐ๊ณต ๋ฆฌ์ŠคํŠธ ๋ชฉ๋ก ์˜์—ญ์ด ํ™”๋ฉด์˜ ๋„ˆ๋น„๋ฅผ ๋„˜์–ด๊ฐˆ ๊ฒฝ์šฐ ํ„ฐ์น˜๋กœ ์ขŒ์šฐ ์Šคํฌ๋กค ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.
  • Mobile์—์„œ ํ›„์›์„ ๊ธฐ๋‹ค๋ฆฌ๋Š” ์กฐ๊ณต ๋ฆฌ์ŠคํŠธ ๋ชฉ๋ก ์˜์—ญ์ด ํ™”๋ฉด์˜ ๋„ˆ๋น„๋ฅผ ๋„˜์–ด๊ฐˆ ๊ฒฝ์šฐ ํ„ฐ์น˜๋กœ ์ขŒ์šฐ ์Šคํฌ๋กค ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.
  • ํ›„์›์„ ๊ธฐ๋‹ค๋ฆฌ๋Š” ์กฐ๊ณต์—์„œ ์›ํ•˜๋Š” ์•„์ด๋Œ ์นด๋“œ์˜ 'ํ›„์›ํ•˜๊ธฐ' ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด ํ•ด๋‹น ์•„์ด๋Œ์„ ํ›„์›ํ•  ์ˆ˜ ์žˆ๋Š” ๋ชจ๋‹ฌ์ฐฝ์ด ๋‚˜ํƒ€๋‚ฉ๋‹ˆ๋‹ค.

ํฌ๋ ˆ๋”ง ์ถฉ์ „ ๋ชจ๋‹ฌ์ฐฝ

์ƒ์„ธ๊ธฐ๋Šฅ
  • ์ถฉ์ „ํ•  ๊ธˆ์•ก์„ ์„ ํƒํ›„ โ€์ถฉ์ „ํ•˜๊ธฐโ€ ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด localstorage๋กœ ๊ด€๋ฆฌ๋˜๋Š” ๋‚ด ํฌ๋ ˆ๋”ง์ด ์ถฉ์ „๋ฉ๋‹ˆ๋‹ค.

ํ›„์›ํ•˜๊ธฐ ๋ชจ๋‹ฌ์ฐฝ

์ƒ์„ธ๊ธฐ๋Šฅ
  • ๋‚ด ํฌ๋ ˆ๋”ง ๋ณด๋‹ค ๋ถ€์กฑํ•œ ํฌ๋ ˆ๋”ง์„ ์ž…๋ ฅ์„ ํ–ˆ์„๋•Œ โ€œํ›„์›ํ•˜๊ธฐ" ๋ฒ„ํŠผ์ด ํ™œ์„ฑํ™” ๋ฉ๋‹ˆ๋‹ค.
  • ํ™œ์„ฑํ™” ๋œ โ€œํ›„์›ํ•˜๊ธฐโ€ ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๋ฉด ํ›„์›์ด ์™„๋ฃŒ๋ฉ๋‹ˆ๋‹ค.
  • ํ›„์›ํ•œ ๋งŒํผ localstorage์—์„œ ๊ด€๋ฆฌ๋˜๋Š” ํฌ๋ ˆ๋”ง์ด ์ค„์–ด๋“ญ๋‹ˆ๋‹ค.

๋ชฉ๋ก ํŽ˜์ด์ง€์˜ ์ด๋‹ฌ์˜ ์ฐจํŠธ(/list)

์ƒ์„ธ๊ธฐ๋Šฅ
  • ๋‚ด ํฌ๋ ˆ๋”ง์€ localstorage๋กœ ๊ด€๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
  • ์ด๋‹ฌ์˜ ์—ฌ์ž ์•„์ด๋Œ ํƒญ์„ ํด๋ฆญํ•˜๋ฉด ํˆฌํ‘œ๊ฐ€ ๋งŽ์€ ์ˆœ์œผ๋กœ ์—ฌ์ž ์•„์ด๋Œ์„ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.
  • ์ด๋‹ฌ์˜ ๋‚จ์ž ์•„์ด๋Œ ํƒญ์„ ํด๋ฆญํ•˜๋ฉด ํˆฌํ‘œ๊ฐ€ ๋งŽ์€ ์ˆœ์œผ๋กœ ๋‚จ์ž ์•„์ด๋Œ์„ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.
  • '์ฐจํŠธ ํˆฌํ‘œํ•˜๊ธฐ' ๋ฒ„ํŠผ์„ ํด๋ฆญ ์‹œ ํˆฌํ‘œํ•˜๊ธฐ ๋ชจ๋‹ฌ์ฐฝ์ด ๋‚˜ํƒ€๋‚ฉ๋‹ˆ๋‹ค.

ํˆฌํ‘œ ๋ชจ๋‹ฌ์ฐฝ

์ƒ์„ธ๊ธฐ๋Šฅ
  • ํˆฌํ‘œํ•˜๋Š” ๋ฐ 1000 ํฌ๋ ˆ๋”ง์ด ์†Œ๋ชจ๋ฉ๋‹ˆ๋‹ค.
  • ์›ํ•˜๋Š” ์•„์ด๋Œ์—๊ฒŒ ๋ฌดํ•œ์œผ๋กœ ํˆฌํ‘œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ํˆฌํ‘œํ•œ ๋งŒํผ localstorage์—์„œ ๊ด€๋ฆฌ๋˜๋Š” ํฌ๋ ˆ๋”ง์ด ์ค„์–ด๋“ญ๋‹ˆ๋‹ค.

3. ๋งˆ์ดํŽ˜์ด์ง€

์ƒ์„ธ๊ธฐ๋Šฅ
  • ๊ด€์‹ฌ ์žˆ๋Š” ์•„์ด๋Œ๋กœ ์ถ”๊ฐ€ํ•˜๊ณ  ์‹ถ์€ ์นด๋“œ๋ฅผ ์ค‘๋ณต์œผ๋กœ ์„ ํƒ์„ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ์„ ํƒ๋œ ์นด๋“œ๋Š” ์ฒดํฌํ‘œ์‹œ๊ฐ€ ๋ฉ๋‹ˆ๋‹ค.
  • '์ถ”๊ฐ€ํ•˜๊ธฐ' ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด ์„ ํƒ๋œ ์นด๋“œ๋“ค์ด ๋‚ด๊ฐ€ ๊ด€์‹ฌ์žˆ๋Š” ์•„์ด๋Œ์— ์ถ”๊ฐ€๊ฐ€ ๋ฉ๋‹ˆ๋‹ค.

9. ํ•ต์‹ฌ ๊ธฐ๋Šฅ

[Axios ๋ชจ๋“ˆํ™”]

axios๋กœ ์„œ๋ฒ„์™€ ํ†ต์‹ ํ•˜๋Š” ๋ชจ๋“  ๋ถ€๋ถ„์—์„œ ์„œ๋ฒ„ ์ฃผ์†Œ์™€ ์ฝ”๋“œ๊ฐ€ ๋ฐ˜๋ณต๋˜์–ด ์ด๋ฅผ ์ค„์ด๊ธฐ ์œ„ํ•ด custom axios๋ฅผ ์‚ฌ์šฉํ•˜์˜€์Šต๋‹ˆ๋‹ค.

import axios from "axios";

const axiosInstance = axios.create({
  baseURL: process.env.REACT_APP_BASE_URL,
  timeout: 10000,
  headers: {
    "Content-Type": "application/json",
  },
});

const dispatcher = async (options) => {
  const client = axiosInstance({ ...options });

  await client;
  return client;
};

export default dispatcher;

[๋น„๋™๊ธฐ ์š”์ฒญ ๊ด€๋ฆฌ]

๋น„๋™๊ธฐ ์š”์ฒญ์„ ๊ด€๋ฆฌํ•˜๋Š” ์ปค์Šคํ…€ ํ›…์„ ์‚ฌ์šฉํ•˜์—ฌ ๋กœ๋”ฉ ์ƒํƒœ, ์—๋Ÿฌ ์ƒํƒœ ๋“ฑ์„ ์‰ฝ๊ฒŒ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ๋„๋ก ํ–ˆ์Šต๋‹ˆ๋‹ค.

import { useState, useEffect } from "react";
import dispatcher from "api/dispatcher";

// @ts-check

/**
 * RequestConfig
 * @typedef {Object} RequestConfig
 * @property {AxiosRequestConfig} options - axios instance์— ์ „๋‹ฌํ•  options
 * @property {boolean} skip - true: ๋งˆ์šดํŠธ๋  ๋•Œ data fetching ๊ธˆ์ง€
 * @property {any[]} deps - useEffect ์˜์กด์„ฑ ๋ฐฐ์—ด
 */

/**
 * @param {RequestConfig} params
 * @returns {Object} Object - { data, isLoading, error, requestFunc  }
 */

export default function useRequest({ options, skip = false, deps = [] }) {
  const [data, setData] = useState(null);
  const [isLoading, setIsLoading] = useState(false);
  const [error, setError] = useState(null);

  const requestFunc = async (...args) => {
    setIsLoading(true);
    setError(null);

    try {
      const response = await dispatcher({ ...options, ...args });

      setData(() => response);
      return response;
    } catch (err) {
      setError(() => err);
      return err;
    } finally {
      setIsLoading(false);
    }
  };

  useEffect(() => {
    if (skip) return;
    requestFunc();
  }, deps);

  return { data, isLoading, error, requestFunc };
}

[ํ•ฉ์„ฑ ์ปดํฌ๋„ŒํŠธ ํŒจํ„ด]

ํ™•์žฅ์„ฑ ์žˆ๊ณ  ์ฝ๊ธฐ ์‰ฌ์šด ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•˜๊ธฐ ์œ„ํ•ด ํ•ฉ์„ฑ ์ปดํฌ๋„ŒํŠธ ํŒจํ„ด์„ ์‚ฌ์šฉํ•˜์˜€์Šต๋‹ˆ๋‹ค.

const Button = Object.assign(DefaultButton, {
  Border: BorderButton,
  Arrow: ArrowButton,
  Round: RoundButton,
  Radio: RadioButton,
  Text: TextButton,
  Link: LinkButton,
});

export default Button;
import Button from 'components/Button';

export default function ExampleComponent() {
  return (
    <>
      <Button.Arrow />
      <Button.Round />
    </>
  )
}

[์ „์—ญ ์ƒํƒœ ๊ด€๋ฆฌ]

Jotai๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ atom๋‹จ์—์„œ localStorage๋ฅผ ๊ด€๋ฆฌํ•˜์—ฌ ์ฝ”๋“œ ์ค‘๋ณต์„ ํ•ด๊ฒฐํ–ˆ์Šต๋‹ˆ๋‹ค.

import { atom } from "jotai";

const storedCreditAtom = atom(localStorage.getItem("Credit") || 0);

const creditAtomWithPersistence = atom(
  (get) => get(storedCreditAtom),
  (get, set, newCredit) => {
    set(storedCreditAtom, newCredit);
    localStorage.setItem("Credit", newCredit);
  },
);

export default creditAtomWithPersistence;

[์ด๋ฏธ์ง€ ์ตœ์ ํ™”]

ํŽ˜์ด์ง€ ๋‚ด์— ์‚ฌ์šฉ๋˜๋Š” ๋ชจ๋“  ์ด๋ฏธ์ง€๋ฅผ Webp ํ™•์žฅ์ž๋กœ ๋ณ€ํ™˜ํ–ˆ์Šต๋‹ˆ๋‹ค.

๋˜ํ•œ Intersection Observer API๋ฅผ ์‚ฌ์šฉํ•ด Lazy Loading ๊ธฐ๋ฒ•์„ ์ ์šฉํ•˜์—ฌ ๋ชฉ๋ก ํŽ˜์ด์ง€์™€ ๋งˆ์ดํŽ˜์ด์ง€์˜ ์ด๋ฏธ์ง€๊ฐ€ viewport ๋‚ด์— ๋“ค์–ด์˜ค๋Š” ์ˆœ๊ฐ„ ๋กœ๋”ฉ๋˜๋„๋ก ๋ณ€๊ฒฝํ–ˆ์Šต๋‹ˆ๋‹ค.

import { useEffect, useRef, useState } from "react";

export default function useLazyImageObserver({ src }) {
  const [imgSrc, setImgSrc] = useState("");
  const imgRef = useRef(null);

  useEffect(() => {
    let observer;

    if (imgRef && !imgSrc) {
      observer = new IntersectionObserver(
        (entries) => {
          entries.forEach((entry) => {
            if (entry.isIntersecting) {
              setImgSrc(src);
              if (imgRef.current) observer.unobserve(imgRef.current);
            }
          });
        },
        { threshold: 0.25 },
      );
      observer.observe(imgRef.current);
    }

    return () => {
      observer && observer.disconnect();
    };
  }, [imgRef, imgSrc, src]);

  return { imgSrc, imgRef };
}

[Skeleton UI]

๋„คํŠธ์›Œํฌ๊ฐ€ ์†๋„๊ฐ€ ๋Š๋ฆฐ ํ™˜๊ฒฝ์—์„œ ์ ‘์†ํ–ˆ์„ ๊ฒฝ์šฐ, ๋กœ๋”ฉ ์ค‘์— ์ปจํ…์ธ  ์œค๊ณฝ์„ ๋‚˜ํƒ€๋‚ด๋Š” UI๋ฅผ ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.

10. ๋Š๋‚€ ์ 

ํ˜œ๋ฆฐ

  • ์ด๋ฒˆ ํ˜‘์—…์œผ๋กœ ๊ฐœ๋ฐœ ๋Šฅ๋ ฅ๋„ ์ค‘์š”ํ•˜์ง€๋งŒ ํ˜‘์—… ๋Šฅ๋ ฅ๋„ ์ค‘์š”ํ•˜๋‹ค๋Š” ๊ฒƒ์„ ๋Š๊ผˆ์Šต๋‹ˆ๋‹ค. ๋˜ ์ •๋ง ์ข‹์€ ํŒ€์›๋ถ„๋“ค์„ ๋งŒ๋‚˜์„œ ํฐ ์„ฑ์žฅ์„ ํ•  ์ˆ˜ ์žˆ์–ด์„œ ํŒ€์›๋“ค์—๊ฒŒ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค:)

๋™ํ˜

  • ์ฒ˜์Œ์œผ๋กœ ํŒ€ ํ”„๋กœ์ ํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๋ฉด์„œ ์ข‹์€ ํŒ€์›๋“ค์„ ๋งŒ๋‚˜ ๊ฐ’์ง„ ๊ฒฝํ—˜๊ณผ ์ข‹์€ ์ถ”์–ต์„ ์–ป๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๋‹ค์–‘ํ•œ ๊ธฐ์ˆ ๋“ค์„ ๋ณด๋ฉด์„œ ๋ถ€์กฑํ•œ ๋ถ€๋ถ„์„ ํŒŒ์•…ํ•˜๊ธฐ ์‰ฌ์› ๊ณ  ์ด๋ฅผ ํ†ตํ•ด ์Šค์Šค๋กœ ๋ฌธ์ œ์ ์„ ์ฐพ๊ณ  ํ•ด๊ฒฐํ•˜๋Š” ๋Šฅ๋ ฅ์ด ํ–ฅ์ƒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.๐Ÿฅฐ

๊ถŒํฌ

  • ํŒ€ ํ˜‘์—… ๊ฐœ๋ฐœ์ด ์ฒ˜์Œ์ด์˜€๋Š”๋ฐ ์ข‹์€ ํŒ€์›๋“ค๊ณผ ํ•  ์ˆ˜ ์žˆ์–ด์„œ ์šด์ด ์ข‹์•˜๋˜ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ํˆฌ๋ช…ํ•˜๊ฒŒ ์†Œํ†ตํ•˜๋Š” ๊ฒƒ์ด ์ •๋ง ์ค‘์š”ํ•˜๋‹ค๋Š” ๊ฒƒ๊ณผ ํ˜‘์—…์—์„œ์˜ git ๊ด€๋ฆฌ๋ฅผ ๋ฐฐ์› ๊ณ , ๋˜ ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ํ•˜๋ฉด์„œ ์„œ๋กœ ์„ฑ์žฅ์„ ๋งŽ์ด ํ•  ์ˆ˜ ์žˆ์—ˆ๋˜ ์‹œ๊ฐ„์ด์˜€๋‹ค๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค. ๐Ÿ™‚

์œจ

  • ํ˜‘์—…์„ ํ†ตํ•ด ์ œ ๋ถ€์กฑํ•œ ์ ์„ ๋Š๋‚„ ์ˆ˜ ์žˆ์—ˆ๊ณ , ๋˜ ๋ฐœ์ „ํ•  ์ˆ˜ ์žˆ๋Š” ๊ธฐํšŒ๊ฐ€ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ƒˆ๋กœ์šด ๊ฒƒ์— ์ฃผ์ €ํ•˜์ง€๋ง๊ณ  ๋„์ „ํ•ด์•ผ๊ฒ ์Šต๋‹ˆ๋‹ค ๐Ÿ˜Š

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 60.0%
  • SCSS 39.3%
  • HTML 0.7%