babel/packages/babel-plugin-transform-react-jsx-self
Nicolò Ribaudo a2aabbd33d
Generate better builder names for JSX* and TS* (#6967)
e.g. JSXIdentifier -> jsxIdentifier.
The jSXIdentifier alias isn't removed, so this commit doesn't introduce breaking changes.
2017-12-07 12:17:40 +01:00
..
2017-03-25 21:46:16 -04:00
2017-12-02 09:38:52 -05:00

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

Adds __self prop to JSX elements, which React will use to generate some runtime warnings. All React users should enable this transform in dev mode.

Example

In

<sometag />

Out

<sometag __self={this} />

Installation

npm install --save-dev @babel/plugin-transform-react-jsx-self

Usage

.babelrc

{
  "plugins": ["@babel/plugin-transform-react-jsx-self"]
}

Via CLI

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

Via Node API

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