Skip to content

jefffriesen/neutrino-preset-class-properties

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Neutrino preset for building javascript applications using class properties

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%