title: Google signin is not working properly on ComponentDidMount
body: <pre><code>  componentDidMount() {
      window.gapi.load("client:auth2", () =&gt; {
        window.gapi.client
          .init({
            clientId:
              process.env.REACT_APP_CLIENT_ID,
            scope: "email"
          })
          .then(() =&gt; {
            this.auth = window.gapi.auth2.getAuthInstance();
            this.onAuthChange(this.auth.isSignedIn.get());
            this.auth.isSignedIn.listen(this.onAuthChange);
          });
      });
    }
  
    // this function will called when auth status changes, according to gapi
    onAuthChange = isSignedIn =&gt; {
      if (isSignedIn) {
        this.props.signIn();
      } else {
        this.props.signOut();
      }
    };
  </code></pre>
  
  <p>when page loads for the first time, depending upon the current auth state of gapi, I changed state through the redux store. but it didn't change the state. It always refers to the initial state, which I hardcoded to null.</p>