Tuesday, June 4, 2024
45
rated 0 times [  49] [ 4]  / answers: 1 / hits: 20968  / 9 Years ago, tue, september 22, 2015, 12:00:00

In my project I'm using React and Babel so I use some ES6 features but mainly those used by React. Webstorm gives me the option to mark my syntax either as ES6 or JSX Harmony and I got confused.



I think I know what ES6/ES2015 is and how to use it with a compiler, eg. Babel.



The hard part id JSX/JSX Harmony. I know that React uses JSX but:




  1. Is this the same JSX as here? If not, which JSX is meant by JSX Harmony option in Webstorm?


  2. I've seen the compatibility page mentioned here and know that JSX Transformer supports only small part of ES6 but also that apparently Babel supports JSX as an addition to ES6 support so JSX seems to be more than ES6 subset... If so, what features of JSX React or JSX Harmony are not part of ES6 specs?




EDIT:



As for question 1 I'm getting sure, these are two completely different things. But what is JSX Harmony then?



EDIT 2:



To answer my own question, Webstorm JSX Harmony refers most probably to the syntax supported by React JSX Compiler with --harmony flag on - adding a bit of ES6 support.


More From » ecmascript-6

 Answers
198

  1. No, it's not the JSX you've mentioned. It's this one.




    JSX is a XML-like syntax extension to ECMAScript without any defined
    semantics. It's NOT intended to be implemented by engines or browsers.



  2. JSX doesn't intend to transpile the ES6 features to ES5, so, it only implements some of the most useful features to help with the templating code.



    If you want to use ES6 today, you must use Babel (preferred) or Traceur to transpile your code to ES5, and then you can use most of the features already available. If you want an even more powerful transpiler, that also has type definitions, you can take a look at Typescript.



[#64970] Sunday, September 20, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tonisandyp

Total Points: 694
Total Questions: 97
Total Answers: 77

Location: British Indian Ocean Territory
Member since Tue, Feb 22, 2022
2 Years ago
;