-
Notifications
You must be signed in to change notification settings - Fork 8
Closed
Description
https://yceffort.kr/2020/10/use-ternaries-not-and-and-in-jsx
안녕하세요, 최근에 yceffort님 블로그를 알게 되서 재미있게 보고 있는 독자입니다 ㅎㅎ
먼저 글을 보다가 이미지가 엑박 뜨는 문제가 있어서 제보합니다.
그리고, 본문에서 제시하신 방법(students.length === 0 &&
)도 좋지만 !students.length &&
와 같이 표현하면 더 짧게 줄일 수 있어서 좋은거 같습니다.
그리고 이번에 React 18이 업데이트 되면서 undefined
리턴이 허용되면서 에러에 대한 걱정이 하나 줄어들었습니다. 이 부분에 대한 언급도 있으면 좋지 않을까 싶습니다 ㅎㅎ
Components can now render undefined: React no longer warns if you return
undefined
from a component. This makes the allowed component return values consistent with values that are allowed in the middle of a component tree. We suggest to use a linter to prevent mistakes like forgetting a return statement before JSX.
- Allow components to render undefined. (#21869 by @rickhanlonii)
Metadata
Metadata
Assignees
Labels
No labels