title: React - saving a component in the ref callback
body: <p>So, extract from <a href="https://facebook.github.io/react/docs/more-about-refs.html#the-ref-callback-attribute">https://facebook.github.io/react/docs/more-about-refs.html#the-ref-callback-attribute</a></p>
  
  <blockquote>
    <p>The ref attribute can be a callback function instead of a name. This callback will be executed immediately after the component is mounted. The referenced component will be passed in as a parameter, and the callback function may use the component immediately, or save the reference for future use (or both).</p>
  </blockquote>
  
  <p>It then only gives an example of using the component immediately. I'm trying to find out how i would use this function to access the component immediately, <em>and</em> save the component for future use, as it says we are able to do.</p>
  
  <p>To continue their specific <code>focus()</code> and <code>theInput</code> example, how would i call <code>focus()</code> on the input element, and save it to the <code>theInput</code> key in refs?</p>
  
  <p>Or put another way, how would i make the <code>console.log</code> in this fiddle return an object with a <code>theInput</code> key of the input element's component ref: <a href="https://jsfiddle.net/qo3p3fh1/1/">https://jsfiddle.net/qo3p3fh1/1/</a></p>