title: React/Firebase how to check authenticated (import or context)?
body: <p>I have a small react application with authentication in Firebase (firebaseui). I have this file in my project:</p>
  
  <pre><code>import * as firebase from 'firebase';
  
  var firebaseConfig = {
    apiKey: '&lt;apikey&gt;',
    authDomain: 'mydomain',
    databaseURL: 'mydomain',
    projectId: 'mydomain',
    storageBucket: 'mydomain',
    messagingSenderId: 'mydomain',
    appId: 'mydomain'
  };
  
  
  firebase.initializeApp(firebaseConfig);
  
  export default firebase;
  export const auth = firebase.auth();
  export const db = firebase.db; 
  </code></pre>
  
  <p>This does work, I exported auth (which is firebase.auth()) and db. Both seem to work, I can access db and auth.currentUser.</p>
  
  <p>I also have context which tells me if the user is signedin:</p>
  
  <pre><code>import * as React from 'react';
  
  import {auth} from '../../helpers/Firebase';
  
  const defaultFirebaseContext = {
    authStatusReported: false,
    isUserSignedIn: false
  };
  
  export const FirebaseAuthContext = React.createContext(defaultFirebaseContext);
  
  export default class FirebaseAuthProvider extends React.Component {
  
      state = defaultFirebaseContext;
  
  
      componentDidMount() {
        auth.onAuthStateChanged(user =&gt; this.setState({
          authStatusReported: true,
          isUserSignedIn: !!user
        }));
      }
  
      render(){
        const {children} = this.props;
        const {authStatusReported, isUserSignedIn} = this.state;
        return (
          &lt;FirebaseAuthContext.Provider value={{isUserSignedIn, authStatusReported}}&gt;
            {authStatusReported &amp;&amp; children}
          &lt;/FirebaseAuthContext.Provider&gt;
        );
      }
  }
  </code></pre>
  
  <p>My question is: when to use what? Because it looks I can just use the first auth object for all my issues (<code>if auth.currentUser !== null</code>) and dont use context AT ALL or is this auth object not reliable at all? It should be reliable because you also have the DB object.</p>
  
  <p>Any help appreciated!!</p>