Skip to content

코드 컨벤션

Dain Lee edited this page Jun 29, 2023 · 13 revisions

type vs interface

  • type : 단일 또는 유니온 타입
  • interface : 객체 타입

named export vs export default

  • 컴포넌트 : export default
  • 함수 : named export

function keyword vs arrow function ✅


주석

❗jsdocs 적극 활용

  • 여러 줄 : /* */
  • 한 줄 : //

폴더 구조

📦src
 ┣ 📂components
 ┃ ┗ 📂component
 ┣ 📂constants
 ┃ ┣ 📜index.ts
 ┃ ┗ 📜.ts
 ┣ 📂hooks
 ┃ ┗ 📜.ts
 ┣ 📂types
 ┃ ┣ 📜index.d.ts
 ┃ ┗ 📜types.d.ts
 ┣ 📂utils
 ┃ ┗ 📜.ts
 ┣ 📂validators
 ┃ ┗ 📜.ts
 ┣ 📜App.ts
 ┗ 📜index.js
  • export될 만한 타입은 분리하기
  • push한 뒤 폴더 구조 수정하기