title: In React - how to find out if a component is mounted at a node
body: <p>I have some code that may render a component:</p>
  
  <pre><code>ReactDOM.render(myComponent, domNode)
  </code></pre>
  
  <p>whether or not this is called depends on a user action.</p>
  
  <p>Later I want to detect if myComponent was indeed rendered and if so remove it. Currently I am doing:</p>
  
  <pre><code>if domNode.childNodes.length &gt; 0
   ReactDOM.unmountComponentAtNode(domNode)
  </code></pre>
  
  <p>What would be the React way of testing for a component existing in the tree? (Without using TestUtils).</p>