I noticed that, at some point, decorators were removed from Babel and one now has to use a plugin to add support. Are decorators “safe” to use, currently, or are they at risk of being removed from the spec? I have situations where my higher-order components are getting out of hand, e.g.:
Decorators are currently in stage 2, so in other words they’re in “Draft” status. That means some form of decorator support is eventually coming, but what that support looks like (and how it will be implemented) is still up in the air. If you don’t mind living on the edge a bit (and don’t mind refactoring your code to adapt to the changing spec), then by all means go for it! That being said, many companies (MDG included) prefer not to use any features below stage 3.
That’s the thing though—and please correct me if I’m wrong—decorators are no longer in stage 2 in Babel 6. I have babel-presets-stage-1 installed, and I can’t use decorators without explicitly adding the transform-decorators-legacy package.
They’re still in stage 2 (that link is up to date). It’s just that Babel has disabled support as their implementation is now very different than the current proposal. For the full details see:
Some very popular libraries like react-dnd and mobx indeed use/offer/recommend decorators and I have a strong feeling once it receives a higher stage status, you will likely have little to no refactoring to do. They make the code easier on the eye and much more perceivable.