You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
모듈
export default
를 수행한다.export
한다.type import/export
export
를 사용한다.정적 파일 import
svg
파일은 index.ts에서ReactComponent
로 한번에 내보낸다..jpg, .png
와 같은 일반이미지는src
링크를import
해 사용한다.스타일 파일 import
React/JSX style Guide
컴포넌트 선언
컴포넌트 Props
Component with Children / Component without Children
PropsWithChildren
을 사용하고, react에서 import한다.Event
Event Handler
prop
으로 넘기는 이벤트 핸들러는on
접두사를 붙인다.handle + 명사 + 동사
형태로 작명한다.Hooks
기본 훅
Ref
네이밍 컨벤션
상수
SNAKE_CASE
로 선언한다.변수
camelCase
로 선언한다.const
를 지향하고,var
는 절대 사용하지 않는다.let
은 값이 변하는 경우에만 사용한다.boolean
타입의 변수는is
접두사를 붙인다.camelCase
를 사용한다.함수
camelCase
로 선언한다.boolean
타입을 리턴하는 함수는is
접두사를 붙인다.CSS Props Naming
Props type Naming
Props
는interface
로 선언하고컴포넌트 명 + Props
로 명명한다.Type Naming
PascalCase
로 선언한다.CSS
크기 단위
%
,px
만 사용한다.0
인 경우 단위를 붙이지 않는다.속성 선언 순서
[CSS 속성 선언 순서 | UXKM](https://uxkm.io/publishing/css/03-cssMiddleclass/10-css_attr_rule#gsc.tab=0)
font, border, margin, padding, background
등의 축약이 가능한 속성은 가능한 한 축약하는 것으로 한다.[단축 속성 - CSS: Cascading Style Sheets | MDN](https://developer.mozilla.org/ko/docs/Web/CSS/Shorthand_properties)
비동기 요청
fetch
를 사용하고 후에 다시 이야기한다.TypeScript
any
를 최대한 지양한다. 필요하다면unknown
을 사용한다.interface
를 사용하며, 그렇지 않다면type
을 사용한다.상수화
Context API vs Recoil vs Redux
디렉터리 구조
src/types
하위에 연관되는 것 끼리 묶어서 위치한다.src/components
하위에 위치한다.공통 컴포넌트는
src/components/common
하위에 해당 컴포넌트로 된 폴더를 생성하여 위치한다.하나의 컴포넌트는 컴포넌트, 스타일, 스토리북 파일을 모두 가지고 있어야한다.
ex) src/components/common/Text/
Beta Was this translation helpful? Give feedback.
All reactions