0.1.1 • Published 7 years ago

neutrino-preset-class-properties v0.1.1

Weekly downloads
2
License
Apache-2.0
Repository
github
Last release
7 years ago

neutrino-preset-class-properties

NPM version

This project provides a Neutrino preset for transforming class properties. Uses the Babel Class properties transform which includes:

class Bork {
    //Property initializer syntax
    instanceProperty = "bork";
    boundFunction = () => {
      return this.instanceProperty;
    }

    //Static class properties
    static staticProperty = "babelIsCool";
    static staticFunction = function() {
      return Bork.staticProperty;
    }
  }

If you're using Mobx with React, you'll need decorators, class properties and the React neutrino presets. Here's a single preset that will take care of that: jke-neutrino-preset-react-mobx

Usage

Create a project with a package.json like this.

{
   "name": "myapp",
   "version": "1.0.0",
   "config": {
      "presets": [
         "neutrino-preset-class-properties"
      ]
   },
   "scripts": {
      "build": "neutrino build",
      "start": "neutrino start"
   },
   "dependencies": {
   },
   "devDependencies": {
      "neutrino": "^4.3.1",
      "neutrino-preset-class-properties": "0.1.1"
   }
}

Now you are ready to put your React components into src/ and start coding. Be aware that Neutrino creates the HTML template for you automatically. For more information see the web sites for Neutrino, React and MobX.

Peer dependencies

peerDependency status