npm

Check out our latest tech talk, "JavaScript Supply Chain Security" presented by VP of Security, Adam Baldwin.Watch it here »

babel-plugin-transform-react-jsx-compat

6.24.1 • Public • Published

babel-plugin-transform-react-jsx-compat

Turn JSX into React Pre-0.12 function calls

Example

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(" "))
);

Installation

npm install --save-dev babel-plugin-transform-react-jsx-compat

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["transform-react-jsx-compat"]
}

Via CLI

babel --plugins transform-react-jsx-compat script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["transform-react-jsx-compat"]
});

Keywords

install

npm i babel-plugin-transform-react-jsx-compat

Downloadsweekly downloads

215

version

6.24.1

license

MIT

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
  • avatar
  • avatar
Report a vulnerability