title: Open Modal in React JS Application on Page Load automatically
body: <p>Below is the <code>App</code> class component in which I want to open Modal once the page gets loaded completely.</p>
  
  <p>Also I tried using <code>componentDidMount()</code> lifecycle method but it failed.</p>
  
  <pre><code>class App extends React.Component {
      constructor(props) {
          super(props);
          this.handleSHow = this.handleShow.bind(this);
          this.state = {
              modalState : true
          }
      }
  
      handleShow = () =&gt; {
          this.setState(() =&gt; {
              return {
                  modalState : false
              };
          });
      }
  
      render() {
          console.log(this.state.modalState)
          return (
              &lt;div&gt;
                  &lt;h1 className="main-title"&gt;My Profile&lt;/h1&gt;
                  &lt;MainContent /&gt;
              &lt;/div&gt;
          );
      }
  }
  
  export default App;
  </code></pre>