코딩 컨벤션 이란 쉽게말해 이름 짓는 방법을 말한다.
코딩 컨벤션이 중요한 이유
const thisIsVariable = true;
const goToHome = () => {
return;
}
pages
ㄴ todo-list
ㄴTodoList.tsx
ㄴ todo-detail
ㄴTodoDetail.tsx
class-name, .item-id
const default_snake_case = '파이썬에서 많이 쓰임 js는 잘 안씀'
// 요건 js 에서 많이 씀
const MILLISECONDS_PER_DAY = 60 * 60 * 24 * 1000; //86400000;
setTimeout(blastOff, MILLISECONDS_PER_DAY);
TodoList.tsx
Detail.tsx
// bad
var goToHome = 1;
// good
let variable = 1;
let phoneNumber = '010-1234-5678'
//bad
let a = 1;
let b = 86400;
const gmName = "kim";
const gf = undefined;
//good
const itemId = 1;
const ONE_DAY_SECONDS = 86400;
const grandMotherName = "kim";
let girlFriend = undefined;
//bad
const good = true;
const girlFriend = true;
//good
const isGood = true;
const thisIsGood = true;
const hasGirlFriend = false;
//mz 최신 유행
const loading = true;
if(isGood)
//bad
const home = () => {}
const eventHandler = () => {}
//good
const goToHome = () => {}
const handleEvent = () => {}
//bad
var todo = [1,2,3,4];
//good
const todos = [1,2,3,4];
const todoList = [1,2,3,4];