@babel/plugin-transform-react-jsx-self
info
This plugin is included in @babel/preset-react
Example
In
<sometag />
Out
<sometag __self={this} />
Installation
- npm
- Yarn
- pnpm
npm install --save-dev @babel/plugin-transform-react-jsx-self
yarn add --dev @babel/plugin-transform-react-jsx-self
pnpm add --save-dev @babel/plugin-transform-react-jsx-self
Usage
With a configuration file (Recommended)
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"],
});