babel-plugin-transform-react-compose-displayname
v2.2.1
Published
private Babel plugin
Downloads
40
Readme
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.
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