3

I'm currently using browserify with reactify plugin to compile jsx code for ReactJS components. This allows me to use certain subset of ES6 in the code (arrow functions, string interpolation etc).

Is there a possibility to use full ES6 (having it compiled down to ES5) with JSX? I think I can't just run ES6TO5 on JSX files before they are processed because of syntax error. Running reactify on ES6 code will give syntax error, I believe also.

Is there a way to use full ES6 with ReactJS and JSX?

Vladislav Rastrusny
  • 29,378
  • 23
  • 95
  • 156
  • 1
    Babel (former 6to5) works fine with JSX and it supports most ES6 features. – elclanrs Feb 24 '15 at 09:25
  • 1
    *"Is there a possibility to use full ES6..."* There ***is*** no "full" ES6, and there won't be until the specification is finalized (currently planned for June 2015, but then again, it was also planned for 2013). The feature set is supposedly frozen, but that doesn't mean there can't be syntax tweaks, late additions that get adequately justified, etc. – T.J. Crowder Feb 24 '15 at 09:59
  • @T.J.Crowder Thank you, but I think you got what I meant. Reactify for Browserify supports only a limited subset of what ES6 will become. Also, specification is currently almost RC1 so I doubt very much syntax will really change. – Vladislav Rastrusny Feb 24 '15 at 14:11
  • 1
    @FractalizeR: Yeah. That's what they said in 2013, too. :-) – T.J. Crowder Feb 24 '15 at 14:24
  • @T.J.Crowder I see ;) – Vladislav Rastrusny Feb 24 '15 at 14:27

2 Answers2

3

You can use Babel to compile "full" (ie, what we have now) ES6/ES2015 using JSX. You can check out Babel's website to see how to do it: How to use JSX.

cyberglot
  • 365
  • 3
  • 32
2

Yes, there is! I spent a while Googling around only to come up empty handed, so I made a skeleton project:

https://github.com/imcnally/react-es6-gulp-playground

ES6 and React, held together with browserify and gulp.

ian
  • 168
  • 1
  • 1
  • 7