@babel/plugin-transform-react-jsx-compat

Example

In

  1. var profile = <div>
  2. <img src="avatar.png" class="profile" />
  3. <h3>{[user.firstName, user.lastName].join(' ')}</h3>
  4. </div>;

Out

  1. var profile = React.DOM.div(null,
  2. React.DOM.img({ src: "avatar.png", "class": "profile" }),
  3. React.DOM.h3(null, [user.firstName, user.lastName].join(" "))
  4. );

Installation

  1. npm install --save-dev @babel/plugin-transform-react-jsx-compat

Usage

  1. {
  2. "plugins": ["@babel/plugin-transform-react-jsx-compat"]
  3. }

Via CLI

  1. babel --plugins @babel/plugin-transform-react-jsx-compat script.js

Via Node API

  1. require("@babel/core").transform("code", {
  2. plugins: ["@babel/plugin-transform-react-jsx-compat"]
  3. });