title: How can I detect if a React component is completely loaded to show ot to hide a section?
body: <p><code>ProfilePage</code> is a react component who display the profile of a user. When I call this component I want to display a <code>&lt;Skeleton.Image/&gt;</code> until the page and its contents are completely loaded. Please, how can I detect if the component is completely loaded and data are completely retrieved?</p>
  <pre><code>class ProfilePage extends Component {
  
    state = {
      all_currency: [],
      still_uploading: true,
      ....
    }
  
    componentDidMount() {
      this.getAccountData(this.props.match.params)
  
      api.post(&quot;/base/getAllCurrency&quot;, {}).then((res) =&gt; {
        this.setState({
          all_currency: res.data.doc
        })
      })
  
      window.addEventListener('load', this.handleLoad); // &lt;===
    }
  
    componentWillUnmount() {
      window.removeEventListener('load', this.handleLoad); // &lt;===
    }
  
    handleLoad = () =&gt; {
      this.setState({
        still_uploading: false
      })
    }
  }
  </code></pre>
  <br/>
  <p>I use the state of the <code>still_uploading</code> to show or to hide the skeleton component.</p>
  <pre><code>{still_uploading &amp;&amp; &lt;Skeleton.Image/&gt;}
  </code></pre>
  <br/>
  <p><strong>PS:</strong> This program works only if I reload the page, but if I went to an other page, and return back to my page, the variable <code>still_uploading</code> will always have <code>true</code> value, and the <code>handleLoad()</code> function is never call back again. Do you have any idea why it doesn't work?</p>
  <br/>
  <p><strong>I also tried to replace:</strong></p>
  <pre><code>window.removeEventListener('load', this.handleLoad);
  </code></pre>
  <p>by:</p>
  <pre><code>ReactDOM.findDOMNode(this).addEventListener(&quot;DOMContentLoaded&quot;, this.handleLoad);
  </code></pre>
  <p>This one with <code>ReactDOM</code> never calls the function <code>handleLoad</code> even if I reload the page</p>
  <br/>
  Please, do you have any idea how to fix it? 
  <br/>
  Regards