jsx

v0.2.1Published 9 years ago

This package has not had recent updates. Please investigate it's current state before committing to using it in your project.

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
7React.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
7React.render(React.createElement(HelloMessage, {name: "John"}), mountNode);