Turn JSX into React Pre-0.12 function calls.
Output JSX into pre-v0.12 React syntax.
In
var profile = <div> <img src="avatar.png" class="profile" /> <h3>{[user.firstName, user.lastName].join(' ')}</h3> </div>;
Out
var profile = React.DOM.div(null, React.DOM.img({ src: "avatar.png", "class": "profile" }), React.DOM.h3(null, [user.firstName, user.lastName].join(" ")) );
npm install --save-dev babel-plugin-transform-react-jsx-compat
.babelrc
(Recommended).babelrc
{ "plugins": ["transform-react-jsx-compat"] }
babel --plugins transform-react-jsx-compat script.js
require("babel-core").transform("code", { plugins: ["transform-react-jsx-compat"] });
© 2018 Sebastian McKenzie
Licensed under the MIT License.
http://babeljs.io/docs/plugins/transform-react-jsx-compat/