-
Install babel plugins to enable decorators.
npm install babel-plugin-transform-decorators-legacy --save-dev
-
Create or update your
.babelrc
file in root folder:{ "presets": ["react-native"], "plugins": ["transform-decorators-legacy"] }
-
Done! Now you can use decorator like:
import {connect} from 'react-redux' @connect(...) class MyComponent extends React.Component{ ... } export default MyComponent
You don't have to scroll to the bottom of the file to see Redux's connect()
Not working. Still says I need to install decorators plugin. Im using create-react-app and mobx