babel-plugin-transform-react-inline-elements

6.22.0 • Public • Published

babel-plugin-transform-react-inline-elements

Replaces the React.createElement function with one that is more optimized for production: babelHelpers.jsx.

Example

In

<Baz foo="bar" key="1"></Baz>;

Out

babelHelpers.jsx(Baz, {
  foo: "bar"
}, "1");
 
/**
 * Instead of
 *
 * React.createElement(Baz, {
 *   foo: "bar",
 *   key: "1",
 * });
 */

Deopt

// The plugin will still use React.createElement when `ref` or `object rest spread` is used
<Foo ref="bar" />
<Foo {...bar} />

Installation

npm install --save-dev babel-plugin-transform-react-inline-elements

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["transform-react-inline-elements"]
}

Via CLI

babel --plugins transform-react-inline-elements script.js

Via Node API

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

References

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
6.22.012,791latest
7.0.0-beta.31,737next

Version History

VersionDownloads (Last 7 Days)Published
7.0.0-beta.31,737
7.0.0-beta.20
7.0.0-beta.10
7.0.0-beta.01
7.0.0-alpha.200
7.0.0-alpha.190
7.0.0-alpha.180
7.0.0-alpha.172
7.0.0-alpha.160
7.0.0-alpha.150
7.0.0-alpha.141
7.0.0-alpha.120
7.0.0-alpha.110
7.0.0-alpha.100
7.0.0-alpha.91
7.0.0-alpha.80
7.0.0-alpha.73
7.0.0-alpha.31
7.0.0-alpha.11
6.22.012,791
6.8.0237
6.6.53
6.6.40
6.5.0-11
6.5.01
6.4.00
6.3.13100
6.2.41
6.1.200
6.1.181
6.1.171
6.1.40
6.1.20
6.0.200
6.0.174
6.0.140
6.0.20

Package Sidebar

Install

npm i babel-plugin-transform-react-inline-elements

Weekly Downloads

11,371

Version

6.22.0

License

MIT

Last publish

Collaborators

  • hzoo
  • loganfsmyth
  • existentialism