삼항 연산자 단순하게 하기 | Frontend Fundamentals #83
Replies: 4 comments 3 replies
-
실제로 React 컴포넌트 코드 작성할 때 많이 놓치는 부분입니다 |
Beta Was this translation helpful? Give feedback.
-
Pattern Matching 문법이 들어온다면 더 개선할 수 있겠군요. |
Beta Was this translation helpful? Give feedback.
-
안녕하세요. 가독성이라는 부분만 고려했을 때, |
Beta Was this translation helpful? Give feedback.
-
경험상 삼항연산자가 4항, 5항으로 불어난 적이 있어, 그냥 용도별 // 초기
const isListShown = !!data?.length
const isLoadingShown = !data?.length
return (
<>
{isListShown && <SomeList data={data} />}
{isLoadingShown && <Loading />}
</>
)
// 후에 이런 식으로 추가되는 경우를 많이 경험
const isListShown = !!data?.length
const isPromotionShown = isLoaded && !data?.length
const isLoadingShown = !isLoaded |
Beta Was this translation helpful? Give feedback.
-
삼항 연산자 단순하게 하기 | Frontend Fundamentals
변경하기 쉬운 프론트엔드 코드를 위한 지침서
https://frontend-fundamentals.com/code/examples/ternary-operator.html
Beta Was this translation helpful? Give feedback.
All reactions