title: Access instance methods in a component wrapped in a Higher Order Component - React.js
body: <p>I am writing some tests for my React component:</p>
  
  <pre><code>let DebugElement = TestUtils.renderIntoDocument(&lt;Debug /&gt;);
  console.log(DebugElement)
  spyOn(DebugElement, 'fetchAndSelect');
  </code></pre>
  
  <p>However, it says that <code>fetchAndSelect</code> doesn't exist. Which is true.</p>
  
  <p>I wrap my component like so:</p>
  
  <pre><code>import { DragDropContext } from 'react-dnd';
  
  const Debug = React.createClass({
       fetchAndSelect() {}
  });
  
  export default DragDropContext(HTML5Backend)(Debug);
  </code></pre>
  
  <p>If you look at the screenshot below, you can see that I can access my component methods inside <code>refs.child</code>. Is this the right way?</p>
  
  <p><a href="https://i.stack.imgur.com/2qCuN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2qCuN.png" alt="enter image description here"></a></p>