prettier
//.prettierrc.js module.exports = { printWidth: 80, semi: true, singleQuote: true, tabWidth: 2, useTabs: false, endOfLine: 'auto', jsxSingleQuote: true, bracketSameLine: true, quoteProps: 'as-needed', trailingComma: 'es5', arrowParens: 'always', bracketSpacing: true, };
컴포넌트
컴포넌트 파일
→ c
amelCase.tsx
→ ie. MyComponent.tsx
컴포넌트 선언 방식
- Arrow Function Component Syntax
- 파일 아래서
export
하기
const MyComponent = ({ propA, propB }) => { } export default MyComponent; const Container = styled.div` `;
페이지
페이지 파일
→
kebab-case.tsx
→ ie. about-us.tsx
페이지 컴포넌트 이름
const AboutUsPage = ({ propA, propB }) => { } export default AboutUsPage;
이벤트 핸들러
컴포넌트 내에서
→
handle[동작][기능]
→ ie. handleClickUpdate
props로 받을때
→
on[동작]
→ ie. onSubmit
파일 구조
Next.js 13의 app디렉토리를 활용합니다.
- app
- user
- user.css
- user_component.tsx
- page.tsx
- pages
- api
- index.ts
- components
- 파일 구조 참고 예시