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

NOTE: This plugin is included in @babel/preset-react

Example

In

  1. <sometag />

Out

  1. <sometag __self={this} />

Installation

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

Usage

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

Via CLI

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

Via Node API

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