Skip to content

TzviPM/babel-plugin-decompose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

babel-plugin-decompose

Split up a compose for HMR

Example

In

export default compose(
  withRouter,
  withTranslation(),
  graphql(...),
)(MyClass);

Out

const _decomposed = MyClass;

const _decomposed2 = graphql(...);

const _decomposed3 = _decomposed2(_decomposed);

const _decomposed4 = withTranslation();

const _decomposed5 = _decomposed4(_decomposed3);

const _decomposed6 = withRouter;

const _decomposed7 = _decomposed6(_decomposed5);

export default _decomposed7;

Installation

$ npm install babel-plugin-decompose

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["decompose"]
}

Via CLI

$ babel --plugins decompose script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["decompose"]
});

About

Split up a compose for HMR

Resources

Stars

Watchers

Forks

Packages

No packages published