[React] && 연산자로 If문 처럼 표현하기
JSX 안에는 중괄호를 이용해서 표현식을 포함 할 수 있습니다. 그 안에 JavaScript의 논리 연산자 &&를 사용하면 쉽게 엘리먼트를 조건부로 넣을 수 있습니다. function GetUnreadTextInfo(props) { const unreadTexts = props.unreadTexts; // ['react', 'test', 'hello'] return ( Hello! {unreadTexts.length > 0 && // unreadTexts.length = 3 You have {unreadTexts.length} unread texts that are {unreadTexts.join(', ')} } ); } const textZip = [ 'react', 'test', 'hello'] Re..