DEV Community

Discussion on: Sh*tpost: can we stop saying "syntactic sugar"?

jckuhl profile image
Jonathan Kuhl

But wouldn't it be more accurate to call JSX a transpilation source?

It's nothing more than React.createElement() under the hood and when run through Babel, that's what you get. It transpiles down to JavaScript.

Sugar, to me anyways, has always been a part of the language itself, but a more friendly way of writing something. The compiler usually rewrites it in its original statement. Like the :: in Java. The :: is not really a java feature, it just makes thing simpler.


reduce(Math::max); gets transformed by the compiler into reduce((int left, int right) -> Math.max(left, right));. The :: is not read by the JVM, but it is replaced by its Java equivalent by the compiler.


Maybe I'm being pedantic, but I think a sugar would be something the language itself accepts. JSX is not accepted by any JavaScript engine without a 3rd party tool.

jenc profile image
jen chan Author

Being pedantic is good for exploring semantics hehe.

And I was being petty in complaining about 2 seconds in an "Intro to React" video in 2016. I agree that it's more intermediary. I came away with the impression that I had to learn an intermediate syntax that was not-JS,not-HTML in order to use React, and it would be transpiled back to ES5 anyway. Maybe it's not necessary anymore and React has changed a ton since--I don't use it but I'm going to get around to familiarizing myself after I cover more JS fundamentals.

Out of curiosity I just looked:

It's all because of IE I guess. I've derailed. Thanks for entertaining my rant.