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.
$ yarn add -D babel-plugin-transform-react-compose-displayname
babel.config.js
module.exports = {
plugins: ['transform-react-compose-displayname']
}
You can specify options:
module.exports = {
plugins: [
['transform-react-compose-displayname', { methodNames: ['compose'] }]
]
}
in
module Selectors = {
let getValue = (. store:store) => Reselect.memoize1(input, (input) => { ... });
};
out
let getValue = (store) => memoize('ModuleName:getValue', [input], (input) => { ... });
in
const MyComp = reactStamp(React).compose({
render() { ... }
});
out
const MyComp = reactStamp(React).compose({
render() { ... }
});
MyComp.displayName = 'MyComp';
MIT