enabling decorators for mobx

mobx is really great for state management (I prefer it over redux)

it is even handier if you can use decorators; to do that its probably easier to use babel 6 (due to some of the issues described here).

using npm install –save you should end add the following packages:

 "babel": "^6.5.2",
 "babel-core": "^6.18.0",
 "babel-loader": "^6.2.7",
 "babel-plugin-transform-decorators-legacy": "^1.3.4",
 "babel-preset-es2015": "^6.18.0",
 "babel-preset-react": "^6.16.0",
 "babel-preset-stage-1": "^6.16.0",

and then just add the following to .babelrc

{
  "presets": [
    "react",
    "es2015",
    "stage-1"
  ],
  "plugins": ["transform-decorators-legacy"]
}

 

refs:

http://jamesknelson.com/using-es6-in-the-browser-with-babel-6-and-webpack/

 

 

 

keywords:

// —- ESNext syntax with decorators —-

ES6 decorators babel

Enabling decorators (optional) Decorators are currently a stage-2 ESNext feature. How to enable them

About Neil Rubens

see http://ActiveIntelligence.org

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*