title: Google Login issue in React js
body: <p>I am New to reactJS and I am trying to google login with my ReactJS app but facing problem that when I am clicking on google login button then googleLogin function calls multiple times and responded multiple times.<br>
  I am trying to resolve this by binding button click event but it effect please review my code and suggest any solution.</p>
  
  <pre><code>   import React, { Component } from 'react';
      import google from './google.png'  
      import config from '../config';
  
      class GoogleLogin extends Component{
         constructor(props) {
             super(props)
         }
  
         componentDidMount(){
             (function() {
                 var e = document.createElement("script");
                 e.type = "text/javascript";
                 e.async = true;
                 e.src = "https://apis.google.com/js/client:platform.js?onload=gPOnLoad";
                 var t = document.getElementsByTagName("script")[0];
                 t.parentNode.insertBefore(e, t)
             })();    
         }
  
         //Triggering login for google
         googleLogin = () =&gt; {
             let response = null;
             window.gapi.auth.signIn({
                 callback: function(authResponse) {
                     this.googleSignInCallback( authResponse )
                 }.bind( this ),
                 clientid: config.google, //Google client Id
                 cookiepolicy: "single_host_origin",
                 requestvisibleactions: "http://schema.org/AddAction",
                 scope: "https://www.googleapis.com/auth/plus.login email"
             });
         }
  
         googleSignInCallback = (e) =&gt; {
             console.log( e )
             if (e["status"]["signed_in"]) {
                 window.gapi.client.load("plus", "v1", function() {
                     if (e["access_token"]) {
                         this.getUserGoogleProfile( e["access_token"] )
                     } else if (e["error"]) {
                         console.log('Import error', 'Error occured while importing data')
                     }
                 }.bind(this));
             } else {
                 console.log('Oops... Error occured while importing data')
             }
         }
  
         getUserGoogleProfile = accesstoken =&gt; {
             var e = window.gapi.client.plus.people.get({
                 userId: "me"
             });
             e.execute(function(e) {
                 if (e.error) {
                     console.log(e.message);
                     console.log('Import error - Error occured while importing data')
                     return
  
                 } else if (e.id) {
                     //Profile data
                     alert("Successfull login from google : "+ e.displayName )
                     console.log( e );
                     return;
                 }
             }.bind(this));
         }
  
         render(){
             return(
                 &lt;img src={google} title="google login" alt="google" onClick={ () =&gt; this.googleLogin() }/&gt;
             )
         }
      }
  
  export default GoogleLogin;
  </code></pre>