title: Uncaught ReferenceError: React is not defined
body: <p>I am trying to make ReactJS work with rails using <a href="http://rny.io/rails/react/2014/07/31/reactjs-and-rails.html" rel="noreferrer">this</a> tutorial. I am getting this error:  </p>
  
  <hr>
  
  <p><code>Uncaught ReferenceError: React is not defined</code></p>
  
  <p>But I can access the React object in browser console<a href="https://i.stack.imgur.com/M0Qaj.png" rel="noreferrer"><img src="https://i.stack.imgur.com/M0Qaj.png" alt="enter image description here"></a><br>
  I also added <a href="https://github.com/ssorallen/turbo-react/blob/master/public/dist/turbo-react.min.js" rel="noreferrer">public/dist/turbo-react.min.js</a> as described <a href="https://stackoverflow.com/questions/29851588/how-can-i-use-this-react-library-with-react-rails?answertab=votes#tab-top">here</a> and also added <code>//= require components</code> line in application.js as described <a href="https://stackoverflow.com/questions/24974478/react-is-not-defined?answertab=votes#tab-top">in this answer</a> to no luck. Additionally,<br>
  <code>var React = require('react')</code> gives the error:<br>
  <code>Uncaught ReferenceError: require is not defined</code>  </p>
  
  <p>Can anyone suggest me on how to resolve this?</p>
  
  <p><strong>[EDIT 1]</strong><br>
  Source code for reference:<br>
  This is my <code>comments.js.jsx</code> file:  </p>
  
  <pre><code>var Comment = React.createClass({
    render: function () {
      return (
        &lt;div className="comment"&gt;
          &lt;h2 className="commentAuthor"&gt;
            {this.props.author}
          &lt;/h2&gt;
            {this.props.comment}
        &lt;/div&gt;
        );
    }
  });
  
  var ready = function () {
    React.renderComponent(
      &lt;Comment author="Richard" comment="This is a comment "/&gt;,
      document.getElementById('comments')
    );
  };
  
  $(document).ready(ready);
  </code></pre>
  
  <p>And this is my <code>index.html.erb</code>:  </p>
  
  <pre><code>&lt;div id="comments"&gt;&lt;/div&gt;
  </code></pre>