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:
Sven SAULEAU
2018-06-04 16:32:39 +02:00
committed by Henry Zhu
parent b6eaaa2496
commit b445b79734
143 changed files with 1286 additions and 11238 deletions

View File

@@ -2,54 +2,18 @@
> Turn JSX into React Pre-0.12 function calls
## Example
See our website [@babel/plugin-transform-react-jsx-compat](https://new.babeljs.io/docs/en/next/babel-plugin-transform-react-jsx-compat.html) for more information.
**In**
## Install
```javascript
var profile = <div>
<img src="avatar.png" class="profile" />
<h3>{[user.firstName, user.lastName].join(' ')}</h3>
</div>;
```
**Out**
```javascript
var profile = React.DOM.div(null,
React.DOM.img({ src: "avatar.png", "class": "profile" }),
React.DOM.h3(null, [user.firstName, user.lastName].join(" "))
);
```
## Installation
Using npm:
```sh
npm install --save-dev @babel/plugin-transform-react-jsx-compat
npm install --save @babel/plugin-transform-react-jsx-compat
```
## Usage
### Via `.babelrc` (Recommended)
**.babelrc**
```json
{
"plugins": ["@babel/plugin-transform-react-jsx-compat"]
}
```
### Via CLI
or using yarn:
```sh
babel --plugins @babel/plugin-transform-react-jsx-compat script.js
```
### Via Node API
```javascript
require("@babel/core").transform("code", {
plugins: ["@babel/plugin-transform-react-jsx-compat"]
});
yarn add --save @babel/plugin-transform-react-jsx-compat
```