title: How can i get access to the current user inside of react from firebase?
body: <p>I may be a bit confused on what firebase is trying to do here. I can get a user to sign into my site using the existing firebase code I have in react, but when I try to get any sort of access to the username of that user (so i can print it out on the screen), I don't get anything.</p>
  
  <p>The filestructure of my react app is index.jsx which loads Login.jsx. Login.jsx looks like this:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import React from 'react';
  import axios from 'axios';
  import * as firebase from 'firebase';
  
  
  
  class Login extends React.Component {
    constructor(props) {
      super(props);
  
      this.state = {email: '', password: ''};
      this.engageLogin = this.engageLogin.bind(this);
      var config = {
        apiKey: "-------------------",
        authDomain: "--------.firebaseapp.com",
        databaseURL: "https://------.firebaseio.com",
        projectId: "-------",
        storageBucket: "-------.appspot.com",
        messagingSenderId: "------------"
      };
      firebase.initializeApp(config);
    }
  
  
    engageLogin (event) {
      var provider = new firebase.auth.GoogleAuthProvider();
      firebase.auth().signInWithPopup(provider).then(function(result) {
      // This gives you a Google Access Token.
      var token = result.credential.accessToken;
      // The signed-in user info.
      var user = result.user;
      });
      event.preventDefault();
    }
  
    render() {
      firebase.auth().onAuthStateChanged(function(user) {
        if (user) {
          console.log('This is the user: ', user)
        } else {
          // No user is signed in.
          console.log('There is no logged in user');
        }
      });
      return (
        &lt;div&gt;
          &lt;div className="container"&gt;
            &lt;h2 className="title"&gt; Stream Labs &lt;/h2&gt;
            &lt;form onSubmit={this.engageLogin}&gt;
              &lt;div className="form-group row"&gt;
                  &lt;div type="submit" className="g-signin2"&gt;Sign in&lt;/div&gt;
              &lt;/div&gt;
            &lt;/form&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      );
    }
  }
  
  export default Login;</code></pre>
  </div>
  </div>
  </p>
  
  <p>From what I understand, that firebase.auth().onAuthStateChanged is supposed to fire off and console.log whenever a user logs in, but I only ever get the 'there is no logged in user' message. Can anyone point me in the right direction here?</p>