Skip to main content

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

info

This plugin is included in @babel/preset-react

Example

In

<sometag />

Out

<sometag __self={this} />

Installation

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

Usage

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

Via CLI

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

Via Node API

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