Open kasperpeulen opened 7 years ago
Please also see the discussion in https://github.com/facebook/jsx/issues/65.
Seems like this is also how reason implemented jsx: http://facebook.github.io/reason/#diving-deeper-jsx
This would be in line with many other tools like that historically use ${foo}
to refer to foo
variable.
I think it is time to make JSX even more like JS and less like HTML. Consider the following JSX:
What about writing it like this:
My main subjective reason is that it just looks more right to me. A more objective reason would be that you could introduce javascript comment syntax:
Similar things could be done for jsx attributes. Instead of:
I would like it as:
Or even better, (I haven't put much thought in this):
More generally:
Inspiration comes from: https://twitter.com/emilpersson/status/795640485683560449
By just making the syntax more close to javascript, I think many long-standing problems would be more easily fixed:
23 - support object literal property value shorthand
25, #51, #64 - Drop the need for curlies around attribute values if they're a single literal, or parenthesis.
35 - Drop implicit text content and curlies as children.
7 - Extend JSXText with Comment?