1. Components 이름은 Pascal case를 사용합니다.
- Good :
function Button = ...
- Bad :
function button = ...
2. 변수 및 함수명에 줄임말 사용은 최대한 지양합니다.
- Good:
getValue()
, addString()
- Bad:
getVal()
, addStr()
3. Component는 함수 표현식 + 화살표 함수로 작성합니다.
- Good:
const Button = () => {}
- Bad:
functon Button()
, const Button = function(){}
4. 각 파일은 Import / Interface(type) / main / export 순으로 작성합니다.
import ...
interface Props
const component = ({}) => {
}
export ...
5. styled component에 인라인 스타일을 넣는 것은 최대한 지양합니다.
- Bad :
<StyledButton style={{...}}>
- styled-component로 최대한 처리
6. prop에 명시하는 이벤트 핸들러 함수를 정의할 때 는 handle 접두사를 사용하고 이벤트의 이름을 사용합니다.