| 양식 | 예시 | |
|---|---|---|
| 폴더명 | Camel | pages, myPage |
| 메서드/훅 | Camel | useFunction, filterByName |
| html | Camel | <Component myProps1=”” myProps2=”” /> |
| js | Camel | const myFunction = () ⇒ {}, const myConsant = “” |
| 컴포넌트 | Pascal | <MainPage /> |
| 상수 | Upper-case | API_BASE=”/api/v1”, API_URL = { MEMBER: {LOGIN: “/path1/path2”}} |
| http | Snake | const data = { recipe_value: 1000, ingredient_value: 500 } |
const MyComponent = (props) => {
return <></>
}
export default MyComponent
// function.js
const filterByName = (props) => {
return result
}
export default filterByName // 개별 파일일 경우만
| 규칙 | 비고 | |
|---|---|---|
| 컴포넌트, 페이지 | .tsx | |
| 스타일 | .style.ts | 스타일이 3개 이상일 경우 다른 파일에서 작업(기존 파일과 동일한 이름) |
| 매서드, 훅 | .ts | |
| 커스텀 타입 (Types) | .d.ts | |
| 글로벌 타입 (@types) | .d.ts | |
| 인터페이스, 타입 | .interface.ts | 연관성이 높은 파일에 함께 작성, 여러번 사용될 시 글로벌 타입, |
| 타입이 20줄 이상 나올 경우 다른 파일에서 작업 |
배열을 변수로 선언할 때는 복수형으로 작성합니다.
const fruits = ['apple', 'banana', 'cucumber'];
RN 기본 스타일로