Copy link to clipboard
Copied
Not sure if this is the right place to report this.
In Boolean algebra, the logical AND operator has higher order-of-operations precedence than logical OR. Therefore, the following two expressions should be equivalent:
(true && true) || (true && false) // Result: true
true && true || true && false // Result: false in JSX (should be true)
In JSX, their results vary as indicated. The second expression is equivalent to this:
((true && true) || true) && false
This does not follow logical order of operations. I confirmed that the two expressions both evaluate to true in other JavaScript engines.
Workaround: Always use parens, but now I can't run my code through a minifier or obfuscator because it removes the extra parens to make the code smaller.
Copy link to clipboard
Copied
This JSX is not JavaScript as you know it.
It has its own view of how it should work. 😄