Browse Source

Use ES6 in Language Tooling doc

main
ankitml 9 years ago
committed by Dan Abramov
parent
commit
4f2168e0d5
  1. 29
      docs/09.1-language-tooling.md

29
docs/09.1-language-tooling.md

@ -37,28 +37,23 @@ Example output:
``` ```
$ cat test.js $ cat test.js
var HelloMessage = React.createClass({ function HelloMessage(props) {
render: function() { return <div>Hello {props.name}</div>;
return <div>Hello {this.props.name}</div>; }
}
});
ReactDOM.render(<HelloMessage name="John" />, mountNode); ReactDOM.render(<HelloMessage name="John" />, mountNode);
$ babel test.js $ babel test.js
"use strict"; "use strict";
var HelloMessage = React.createClass({ function HelloMessage(props) {
displayName: "HelloMessage", return React.createElement(
"div",
render: function render() { null,
return React.createElement( "Hello ",
"div", props.name
null, );
"Hello ", }
this.props.name
);
}
});
ReactDOM.render(React.createElement(HelloMessage, { name: "John" }), mountNode); ReactDOM.render(React.createElement(HelloMessage, { name: "John" }), mountNode);
``` ```

Loading…
Cancel
Save