title: Ref error in React.JS Ref - createRef, useRef, and using Refs
body: <p>I am trying to use the <code>ref</code> property using React. I get a strange error in my browser, and I am not able to figure out what the problem is. 
  Can anyone explain to me why I get this error:</p>
  
  <blockquote>
    <p>Error: Invariant Violation: addComponentAsRefTo(...): Only a ReactOwner can have refs. This usually means that you're trying to add a ref to a component that doesn't have an owner (that is, was not created inside of another component's <code>render</code> method). Try rendering this component inside of a new top-level component which will hold the ref.</p>
  </blockquote>
  
  <p>when I have this code:</p>
  
  <pre class="lang-js prettyprint-override"><code>/**
  * @jsx React.DOM
  */
  (function(){
  var react = require('react');
  
  
  var App = react.createClass({
  
      render: function() {
          return (
              &lt;h1 ref="myRef"&gt;This is a test&lt;/h1&gt;
          );
      }
  
  });
  
  react.render(
      &lt;App /&gt;,
      document.body
  );
  }());
  </code></pre>