title: Using google sign in button with react 2
body: <p>This is essentially the same question as <a href="https://stackoverflow.com/questions/31610461/using-google-sign-in-button-with-react">Using google sign in button with react</a> but the accepted answer does not solve it in my case. </p>
  
  <p>I have a react component:</p>
  
  <pre><code>var LoginButton = React.createClass({
  
  onSignIn: function(googleUser) {
    console.error(" user signed in");                                                                                                                                                               
  },
  
  componentDidMount: function() {
    console.log('component has mounted');
      gapi.signin2.render('g-signin2', {
        'scope': 'https://www.googleapis.com/auth/plus.login',
        'width': 200,
        'height': 200,
        'longtitle': true,
        'theme': 'dark',
        'onsuccess': this.onSignIn
      })
  },
  
  render: function() {
    return (
       &lt;div className="g-signin2"/&gt;
    );
  }
  }
  </code></pre>
  
  <p>But while the sign-in works successfully, the onSignIn function is never called. In fact none of the options I specify for rendering the custom signin button are present (i.e. the square shape and dark theme), so I guess it's rendering a default button because of the <code>&lt;div&gt;</code>'s class. </p>
  
  <p>I'm currently loading the library synchronously because otherwise <code>gapi</code> is not in scope when <code>componentDidMount</code> is triggered.</p>
  
  <p>The other option I see would be google's recommendation of using <code>&lt;script src="https://apis.google.com/js/platform.js?onload=renderButton" async defer&gt;&lt;/script&gt;</code> and wrapping my render in a function. But then either this script has to be loaded inside the component, or else I have to find a way that this function is in scope to be passed as a callback in <code>index.html</code>, neither of which seem like a good solution.</p>
  
  <p>How can I get the custom login button to be rendered instead of the default one?</p>