How to refer JSX file to an HTML Page

Viewed 5448

I have referred JSX file in HTML Page and the page is not displaying any content.

HTML (Index.html)

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>My First React Example</title>
  </head>
  <body>
    <div id="container"></div>
    <script src="https://***/react-15.0.0.js"></script>
    <script src="https://***/react-dom-15.0.0.js"></script>
    <script type="text/javascript" src="script.js"></script>
  </body>
</html>

JSX (Script.js)

var CommentBox = React.createClass({
  render: function() {
    return (
      <div className="commentBox">
        Hello, world! I am a CommentBox.
      </div>
    );
  }
});


ReactDOM.render(
  <CommentBox />,
  document.getElementById('container')
);

I have tried change the file extension to .jsx/.js and still no luck.

1 Answers
Related