683 BMarkdownView Raw
1# babel-plugin-transform-react-jsx-self
2
3> 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.
4
5## Example
6
7**In**
8
9```
10<sometag />
11```
12
13**Out**
14
15```
16<sometag __self={this} />
17```
18
19## Installation
20
21```sh
22npm install --save-dev babel-plugin-transform-react-jsx-self
23```
24
25## Usage
26
27### Via `.babelrc` (Recommended)
28
29**.babelrc**
30
31```json
32{
33 "plugins": ["transform-react-jsx-self"]
34}
35```
36
37### Via CLI
38
39```sh
40babel --plugins transform-react-jsx-self script.js
41```
42
43### Via Node API
44
45```javascript
46require("babel-core").transform("code", {
47 plugins: ["transform-react-jsx-self"]
48});
49```