I think ternary expression are rather ok here, though not perfect:
{cond1 && cond2
? <div>foo</div>
: null
} {cond1 && cond2
? <div>foo</div>
: null
} {(() => {
if (cond1 && cond2)
return <div>foo</div>
else
...
})()}
Though it makes GitHub think it's a Clojure file. {(() => {
})()}
Honestly I can't decide if I think this is ugly or beautiful. It's like the buffalo buffalo of JS. {do {
if (cond1 && cond2)
<div>foo</div>
else
...
}}
If JSX decides to implement "implicit" "do expressions", I suppose it would just look like this: {
if (cond1 && cond2)
<div>foo</div>
else
...
}
http://wiki.ecmascript.org/doku.php?id=strawman:do_expressio...