mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-23 20:23:08 +00:00
[docs] Update Getting Started for babel 6
This commit is contained in:
@@ -30,10 +30,15 @@ ReactDOM.render(
|
||||
To install React DOM and build your bundle after installing browserify:
|
||||
|
||||
```sh
|
||||
$ npm install --save react react-dom
|
||||
$ browserify -t babelify main.js -o bundle.js
|
||||
$ npm install --save react react-dom babelify babel-preset-react
|
||||
$ browserify -t [ babelify --presets [ react ] ] main.js -o bundle.js
|
||||
```
|
||||
|
||||
> Note:
|
||||
>
|
||||
> If you are using ES2015, you will want to also use the `babel-preset-es2015` package.
|
||||
|
||||
|
||||
## Quick Start Without npm
|
||||
|
||||
If you're not ready to use npm yet, you can download the starter kit which includes prebuilt copies of React and React DOM.
|
||||
@@ -94,16 +99,20 @@ Note that some browsers (Chrome, e.g.) will fail to load the file unless it's se
|
||||
First install the [Babel](http://babeljs.io/) command-line tools (requires [npm](https://www.npmjs.com/)):
|
||||
|
||||
```
|
||||
npm install --global babel
|
||||
npm install --global babel-cli
|
||||
npm install babel-preset-react
|
||||
```
|
||||
|
||||
Then, translate your `src/helloworld.js` file to plain JavaScript:
|
||||
|
||||
```
|
||||
babel src --watch --out-dir build
|
||||
|
||||
babel --presets react src --watch --out-dir build
|
||||
```
|
||||
|
||||
> Note:
|
||||
>
|
||||
> If you are using ES2015, you will want to also use the `babel-preset-es2015` package.
|
||||
|
||||
The file `build/helloworld.js` is autogenerated whenever you make a change. Read the [Babel CLI documentation](http://babeljs.io/docs/usage/cli/) for more advanced usage.
|
||||
|
||||
```javascript{2}
|
||||
|
||||
Reference in New Issue
Block a user