Refactor move docs (#8108)
* feat: [skip] generate readme script * docs: [skip ci] update READMEs * docs: [skip ci] fix code block type * chore: [skip ci] move generator script
This commit is contained in:
@@ -1,55 +1,19 @@
|
||||
# @babel/plugin-transform-react-display-name
|
||||
|
||||
> Add displayName to `createReactClass` (and `React.createClass`) calls
|
||||
> Add displayName to React.createClass calls
|
||||
|
||||
## Example
|
||||
See our website [@babel/plugin-transform-react-display-name](https://new.babeljs.io/docs/en/next/babel-plugin-transform-react-display-name.html) for more information.
|
||||
|
||||
**In**
|
||||
## Install
|
||||
|
||||
```js
|
||||
var foo = React.createClass({}); // React <= 15
|
||||
var bar = createReactClass({}); // React 16+
|
||||
```
|
||||
|
||||
**Out**
|
||||
|
||||
```js
|
||||
var foo = React.createClass({
|
||||
displayName: "foo"
|
||||
}); // React <= 15
|
||||
var bar = createReactClass({
|
||||
displayName: "bar"
|
||||
}); // React 16+
|
||||
```
|
||||
|
||||
## Installation
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/plugin-transform-react-display-name
|
||||
npm install --save @babel/plugin-transform-react-display-name
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Via `.babelrc` (Recommended)
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["@babel/plugin-transform-react-display-name"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
babel --plugins @babel/plugin-transform-react-display-name script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["@babel/plugin-transform-react-display-name"]
|
||||
});
|
||||
yarn add --save @babel/plugin-transform-react-display-name
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user