I’m creating simple application using React Redux. I want to use decorator to inject some methods in my component.. I saw similar code in other projects:
import
Babel 6 doesn't support decorators with the es2015
preset, nor with the stage-0
preset. You'll have to add the babel-plugin-transform-decorators-legacy
plugin to enable decorators:
$ npm install --save-dev babel-plugin-transform-decorators-legacy
And add to your plugins in .babelrc
:
{
"plugins": [
"transform-decorators-legacy",
...
]
}
This is the easiest way I know of to get decorator support. They're not included in babel by default as they haven't actually been standardized yet.