Closed
Description
This is a common pattern:
<div onClick={condition && () => {}} className={condition && 'foo'} />
However if condition is false
, 0
or ""
then this correctly warns.
You should have used condition ? ... : undefined
instead.
We could suggest that more specifically in the warning.
The longer term alternative is to use the proposed more concise ??
operator.