TLDR: CoffeeScript is good, but in my opinion, it isn’t the right choice for ReactJS. It is easier to go with ES6 if you want to work on both Rails and non-Rails apps.
Hi, for the last two months I have been switching from CoffeeScript to ES6 on my ReactJS projects. In fact when I started my part time job — and started learning React — I had to integrate React to an existing Ruby on Rails project. As you know most Rails developers use CoffeeScript, so I had to start working with it.
Hopefully the react-rails gem that I used did support CoffeeScript and it does work pretty well !
So why the hell did I switch to ES6?
As I told in my previous post, I am starting to learn Redux and other libraries that I can combine with ReactJS. Redux needs NPM to be installed and as I am no Rails pro, I didn’t think it was possible to have it on my app. Therefore I started learning Redux on other side projects without Rails. I was first using Browserify and it was a pain in the ass to get CoffeeScript to be compiled along with React… So I just went without it on these projects and started to learn how to write ReactJS without CoffeeScript. At first it was a mess ! I constantly forgot the curly brackets, the semicolons, the
var keyword, … CoffeeScript is so easy and practical, why did I even try using something else?!
The thing that made me switch to ES6 is React’s Add-Ons. I had been trying to use React’s Animation for a while and never achieved to make it work (and still don’t), so I asked for help on stackoverflow and here was the first answer:
I already intended rewriting my code since I didn’t split well my components, so it didn’t take me much time to decide to do so using ES6. It’s quite easy to switch from one to the other and ES6 isn’t really hard to learn either.
Now I only work with ES6 and no longer use CoffeeScript which looks too compact and actually scares me.
CoffeeScript is good, but in my opinion, it isn’t the right choice for ReactJS.