You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see JSX as an essential part of React that makes it popular and loved.
I hope the JSX specification evolves over time. Even if is small minor syntax sugar improvements.
When adding sugar for raw number isn't hard from parser perspective, support for omitting {} around AssignmentExpression adds ambiguity for parser.
Consider this <div onClick={ foo } />
The onClick attribute could be parsed as both ObjectLiteral with foo property shorthand and as AssignmentExpression of foo identifier.
The only way for omitting curly braces is to restrict possible expressions eliminating ambiguity.
Activity
thers commentedon Mar 17, 2020
When adding sugar for raw number isn't hard from parser perspective, support for omitting
{}aroundAssignmentExpressionadds ambiguity for parser.Consider this
<div onClick={ foo } />The
onClickattribute could be parsed as bothObjectLiteralwithfooproperty shorthand and asAssignmentExpressionoffooidentifier.The only way for omitting curly braces is to restrict possible expressions eliminating ambiguity.