Conditional Rendering

hey hey·2021년 12월 7일
0

React 자료

목록 보기
5/18
post-thumbnail

조건에 따른 렌더링

&& 연산자 → if

ex) { a > 0 **&&** <h2>내용</h2>}

  => a 가 0보다 크면 뒤에 내용 return 

? → if else

{condition ? 'true' : 'false'}

Component 렌더링 막기

  • return null 을 하게 되면 막을 수 있다.
  • == pass 랑 비슷?
profile
FE - devp

0개의 댓글