title: React and on load event
body: <p>I'm trying to implement a pre-loader in React,</p>
  
  <p>I tried the following</p>
  
  <pre><code>class MainApp extends React.Component {
  
    componentDidMount() {
      this.preloader.style.display = 'none';
    }
  
    render() {
      return (
          &lt;div id="loader-container" ref={(c) =&gt; { this.preloader = c; }} /&gt;
          &lt;SomeComponent /&gt;
      );
    }
  }
  </code></pre>
  
  <p>However, it seems that the pre-loader disapper long before the load is complete.</p>
  
  <p>How can I bind the removal of the pre-loader to the load event?</p>