Comment by JimDabell
5 years ago
Right from the very top of your source:
> JSX is an XML-like syntax extension to ECMAScript without any defined semantics. It's NOT intended to be implemented by engines or browsers. It's NOT a proposal to incorporate JSX into the ECMAScript spec itself. It's intended to be used by various preprocessors (transpilers) to transform these tokens into standard ECMAScript.
Further down:
> Why not just use that instead of inventing a syntax that's not part of ECMAScript?
It is not JavaScript.
We're splitting hairs now. It's an extension of the JS spec. Once a parser adds this grammar it is JS.
It's syntactical sugar, unlike template syntax #if, ng-if, etc.
Your argument is it's not part of the current Ecmascript spec, I never said it was, but if a parser or engine adds these two new PrimaryExpressions and attributes, it is JS.
The entire point is JSX extends JS to allow templating via nested JS functions w/ pretty brackets instead of creating an entire templating system.
Under your reasoning nothing that isn't in the current accepted Ecmascript spec implemented by browsers is JS. Does that mean decorators aren't JS? Were async functions not JS before they were in browsers?
We’re not splitting hairs. It is, quite literally, not JavaScript in a fundamental way.
If you want to go around telling people it’s a non-standard extension to JavaScript or if you want to go around telling people it’s a superset of JavaScript, then by all means do that. But it is simply not JavaScript. Why do you insist on saying otherwise? All that does is start completely pointless arguments. What do you gain from insisting it is JavaScript when it isn’t?
I think you're getting a little too worked up.
The point is this small extension to JS grammar lets you do templating with normal JS, instead of #for you can use .forEach, .map and other array methods.
You can use JS instead of replacing tokens in a template.
It's not a superset of JS, that's not accurate, it's an extension of the spec.
I hope the JSX spec is added to the standard sometime to stop this stupid debate.
Until you realize what JSX is you don't realize the full potential it has over templates.
20 replies →