跳到主要内容

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

信息

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"],
});