JSX
A build plugin that compiles files with the .jsx
extension from JSX to plain
JavaScript. Also transpiles some of the most useful ES6 features.
XXX list of ES6 features here.
JSX before compilation
1var HelloMessage = React.createClass({ 2 render: function() { 3 return <div>Hello {this.props.name}</div>; 4 } 5}); 6 7ReactDOM.render(<HelloMessage name="John" />, mountNode);
JavaScript after compilation
1var HelloMessage = React.createClass({displayName: "HelloMessage", 2 render: function() { 3 return React.createElement("div", null, "Hello ", this.props.name); 4 } 5}); 6 7ReactDOM.render(React.createElement(HelloMessage, {name: "John"}), mountNode);