Browse Source

[docs] Update Getting Started for babel 6

main
Paul O’Shannessy 9 years ago
parent
commit
9dfe204a82
  1. 19
      docs/getting-started.md

19
docs/getting-started.md

@ -30,10 +30,15 @@ ReactDOM.render(
To install React DOM and build your bundle after installing browserify: To install React DOM and build your bundle after installing browserify:
```sh ```sh
$ npm install --save react react-dom $ npm install --save react react-dom babelify babel-preset-react
$ browserify -t babelify main.js -o bundle.js $ 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 ## 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. 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/)): 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: 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. 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} ```javascript{2}

Loading…
Cancel
Save