2.2.1 • Published 2 years ago

babel-plugin-transform-react-compose-displayname v2.2.1

Weekly downloads
84
License
MIT
Repository
github
Last release
2 years ago

Private babel plugin that can:

  • rewrite memoization function to add key based on module/function name
  • (obsolete) add a displayName to a component created by composition, using reactStamp or another function.

npm version

Installation

$ yarn add -D babel-plugin-transform-react-compose-displayname

Usage

babel.config.js

module.exports = {
    plugins: ['transform-react-compose-displayname']
}

You can specify options:

module.exports = {
    plugins: [
        ['transform-react-compose-displayname', { methodNames: ['compose'] }]
    ]
}

Rewrites

Memoize

in

module Selectors = {
  let getValue = (. store:store) => Reselect.memoize1(input, (input) => { ... }); 
};

out

let getValue = (store) => memoize('ModuleName:getValue', [input], (input) => { ... });

Add display name

in

const MyComp = reactStamp(React).compose({
  render() { ... }
});

out

const MyComp = reactStamp(React).compose({
  render() { ... }
});
MyComp.displayName = 'MyComp';

Links

License

MIT

2.2.1

2 years ago

2.2.0

2 years ago

2.1.0

2 years ago

2.0.0

2 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago