- FE : React
- BE : Node.js, Express
-
space์ tab ํผ์ฉํ์ง ์๊ธฐ
-
ํ ์ค์ ํ๋์ ๋ฌธ์ฅ๋ง ํ์ฉ
-
๋ฌธ์ฅ ์ข ๋ฃ ์ ์ธ๋ฏธ์ฝ๋ก ๋ฐ๋์ ์ฌ์ฉ
-
๋ณ์์ ํจ์์ ์ด๋ฆ์ ์นด๋ฉ ์ผ์ด์ค ์ฌ์ฉ
-
ํด๋์ค์ ์ปดํฌ๋ํธ์ ์ด๋ฆ์ ํ์ค์นผ ์ผ์ด์ค ์ฌ์ฉ
-
๋ณ์ ์ ์ธํ ๋ const์ let ์ฌ์ฉ
-
๋ฆฐํ -ESLint, ํฌ๋งคํ -Prettier ์ฌ์ฉ
์ฐธ๊ณ : ์ฝ๋ฉ์ปจ๋ฒค์ | TOAST UI :: Make Your Web Delicious!
- ์ฝ๋ ์ ๋ค์ ๊ณต๋ฐฑ ์ฌ์ฉํ๊ธฐ (์ฐ์ฐ์ ๋ฑ)
- ์ฝค๋ง ๋ค์๋ ๋์ด์ฐ๊ธฐ
//bad
app.listen(3000,()=>console.log('Server Started'))
//good
app.listen(3000, () => console.log('Server Started'));- ์์ ๋ฐ์ดํ ์ฌ์ฉํ๊ธฐ
// bad
const a = "No"
// good
const b = 'Yes';- ์ค๊ดํธ ์ด๊ธฐ ์ ์ ์ค ๋ฐ๊พธ์ง ์๊ธฐ
- ์ค๊ดํธ ๋ซ๊ธฐ ์ ์ ์ค ๋ฐ๊พธ๊ธฐ
if (n < 0) {
alert(`Power ${n} is not supported`);
};- ๋ชจ๋ ๊ตฌ๋ฌธ ๋์ ์ธ๋ฏธ์ฝ๋ก ๋ถ์ด๊ธฐ
- ๊ณต๋ฐฑ 2์นธ ๋ค์ฌ์ฐ๊ธฐ
//bad
async function getColorSurvey(id) {
const res = await axios.get(`https://learn.codeit.kr/api/color-surveys/${id}`)
return res.data
}
//good
async function getColorSurvey(id) {
const res = await axios.get(`https://learn.codeit.kr/api/color-surveys/${id}`);
return res.data;
};- ๊ฐ๋ก ๊ธธ์ด ๋๋ฌด ๊ธธ๊ฒ ํ์ง ์๊ธฐ
๋ค์ด๋ฐ ์ ๋ฆฌ
- ์ฐ์์ ๋๋ฌ๋๋ ์ด๋ฆ ์ฐ๊ธฐ
- ์นด๋ฉ์ผ์ด์ค : ๋ณ์, ํจ์ ๋ฑ (myName, getColor)
- ํ์ค์นผ ํ๊ธฐ๋ฒ: ํด๋์ค (UserProfile)
- ์ค๋ค์ดํฌ ํ๊ธฐ๋ฒ + ๋๋ฌธ์ : ์์ (DEFAULT_LANGUAGE)
๋ณ์
- const๋ฅผ ๊ธฐ๋ณธ์ผ๋ก ์ฌ์ฉ, ํ์์ let ์ฌ์ฉ ( var ์ฌ์ฉํ์ง ์๊ธฐ )
- ํ ๋ฒ์ ๋ณ์ ํ๋๋ง ์ ์ธํ๊ธฐ
// bad
var a = 1, b = 2;
// good
const a = 1;
const b = 2;ํจ์
- arrow function ๋ฌธ๋ฒ(
=>)๊ณผ ๋น๊ต ์ฐ์ฐ์ (<=,ย>=)๋ฅผ ํจ๊ป ์ฌ์ฉํ ๊ฒฝ์ฐ, ์๊ดํธ(())๋ฅผ ์ด์ฉํ์ฌ ํํํ๊ธฐ
// bad
const itemHeight = item => item.height > 256 ? item.largeSize : item.smallSize;
// good
const itemHeight = (item) => {
const { height, largeSize, smallSize } = item;
return height > 256 ? largeSize : smallSize;
};- ํจ์ ์ด์ธ์ ๋ธ๋ก (if๋ while๊ฐ์) ์์์ ํจ์๋ฅผ ์ ์ธํ์ง ์๊ธฐ
// bad
let i;
for (i = 10; i; i--) {
(function() {
return i;
})();
}
// bad
while(i) {
let a = function() {
return i;
};
a();
}
// good
const a = function() {};
let i;
for (i = 10; i; i--) {
a();
}- ํ๋ผ๋ฏธํฐ ๊ธฐ๋ณธ๊ฐ์ ๊ฐ์ฅ ๋ค์ ์์นํ๊ธฐ
- ์ด์ฐ์ : ๊ทธ๋ฃน/๋๊ธ FE
- ์ฅ๋คํ : ๊ฒ์๊ธ(์ถ์ต)/๋ฐฐ์ง ๊ธฐ๋ฅ FE
- ์ ์๋น : ๊ฒ์๊ธ(์ถ์ต) BE
- ์ฅ์ง์ธ : ๊ทธ๋ฃน BE, ํ์ฅ
- ํ์ ํ : ๋๊ธ/๋ฐฐ์ง BE