title: Set a default ref value on React?
body: <p>So my code looks like so:</p>
  
  <pre><code>stockconfirmbuy: function(){
    var totalbuyval = this.refs.stockpriceref.innerHTML * this.refs.stockdnum.value;    
      return (&lt;div&gt;
           &lt;input type="number" value="1" ref="stockdnum" /&gt; 
           &lt;p&gt;Your Total:&lt;/p&gt;
           &lt;p&gt;${totalbuyval}&lt;/p&gt;              
  &lt;/div&gt;);
  },  
  </code></pre>
  
  <p>My problem here is that I get a <code>Cannot read property 'value' of undefined</code> error. This refers to my <code>input type="number"</code>. </p>
  
  <p>However, I have been trying to give my input a default value so that this does not occur. I gave it a default <code>value=1</code>, but this does not seem to satisfy the ref. </p>
  
  <p>So I am wondering what I need to do to set a default ref value. Or should I be using state? </p>