🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

babel-plugin-transform-react-inline-elements

Package Overview
Dependencies
Maintainers
6
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-react-inline-elements

Turn JSX elements into exploded React objects

6.22.0
latest
Source
npm
Version published
Weekly downloads
22K
66.37%
Maintainers
6
Weekly downloads
 
Created
Source

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

.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

  • [facebook/react#3228] Optimizing Compiler: Inline React Elements

Keywords

babel-plugin

FAQs

Package last updated on 20 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts