-
[17]인라인 조건식이란?dev/Web 2021. 4. 12. 19:08
JSX에서 if-else 분기를 사용하기 위한 방법으로 JSX랜더때 분기를 줄 수 있다.
<h1>Hello!</h1> { messages.length > 0 && !isLogin? <h2> You have {messages.length} unread messages. </h2> : <h2> You don't have unread messages. </h2> }
'dev > Web' 카테고리의 다른 글
[18]"key"는 무엇이며 사용할 때의 이점은 무엇인가? (0) 2021.04.12 [16]합성 이벤트(synthetic events)란? (0) 2021.04.12 [15]이벤트 핸들러 또는 콜백에 매개 변수를 전달하는 방법 (0) 2021.04.12 [14]JSX 콜백에서 메서드 또는 이벤트 핸들러를 바인딩하는 방법 (0) 2021.04.12 [13]HTML과 React 이벤트 처리의 차이점 (0) 2021.04.12