1.1.0 • Published 7 years ago
babel-plugin-transform-react-cache v1.1.0
babel-plugin-transform-react-cache
Example
in
function fn(props) {
var a = props.a;
return React.createElement(
'div',
{ cache: function(n, o) { return n.a === o.a; }, a }
);
}
out
(function () {
var _ref = function (n, o) {
return n.a === o.a;
};
return function (props) {
var a = props.a;
return ReactCache.createElement(_ref)('div', { a });
};
})();
Installation
npm install --save-dev babel-plugin-transform-react-cache
Usage
Via .babelrc (Recommended)
.babelrc
{
plugins: [transform-react-cache]
}
Via CLI
babel --plugins transform-react-cache script-to-transform.js
Via Node API
require("babel-core").transform("code", {
plugins: ["transform-react-cache"]
});