A babel plugin that make react-components into original js.
Before:
ReactDOM.render(<HelloWorld />, document.getElementById('wrap'))
After:
window['ICAT'] && window['ICAT'].react?
ICAT.react(function(el){ ReactDOM.render(<HelloWorld />, el); }) :
ReactDOM.render(<HelloWorld />, document.getElementById('wrap'));
$ npm install babel-plugin-react-originjs
.babelrc
{
"plugins": ["react-originjs"]
}
$ babel --plugins react-originjs script.js
require('babel-core').transform('code', {
plugins: ['react-originjs']
});
MIT