I play with React and I had a problem with the standalone JSX compiler.
Here is my JSX code in a file called helloworld.js , placed in a folder named src in the root directory of my project:
var Hello = React.createClass({ render: function () { return <div> <h3>Hello, {this.props.name}</h3> </div> } }); React.renderComponent( <Hello name={"Jane Doe"} />, document.getElementById('example') );
On the command line, when I go to the root directory of my project and I run this:
jsx /src /build
The output helloworld.js file is created in the build folder, but it does not contain valid JavaScript.
Here is what the content looks like:
var Hello = React.createClass({displayName: "Hello", render: function () { return <div> <h3>Hello, {this.props.name}</h3> </div> } }); React.renderComponent( <Hello name={"Jane Doe"} />, document.getElementById('example') );
As you can see, it still contains embedded HTML instead of valid JavaScript. There is no error message on the command line. It looks like this:
built Module("helloworld") ["helloworld"]
Does anyone have an idea why this could happen?
source share