title: How to fix undefined is not an object (evaluating 'firebase.apps.length')
body: <p>This is my code</p>
  <pre><code>import * as firebase from &quot;firebase/app&quot;;
  import &quot;firebase/auth&quot;;
  import &quot;firebase/firestore&quot;;
  
  
  const firebaseConfig = {
      apiKey: &quot;removed&quot;,
      authDomain: &quot;removed&quot;,
      projectId: &quot;removed&quot;,
      storageBucket: &quot;removed&quot;,
      messagingSenderId: &quot;removed&quot;,
      appId: &quot;removed&quot;,
      measurementId: &quot;removed&quot;
    };
  
    let app;
  
    if(firebase.apps.length === 0) {
        app = firebase.initializeApp(firebaseConfig);
    } else {
        app = firebase.app();
    }
  
    const db = app.firestore();
    const auth = firebase.auth();
  
    export { db, auth };
  
  </code></pre>
  <p>And the error i have is</p>
  <p>`undefined is not an object (evaluating 'firebase.apps.length')
  (D'</p>
  <pre><code>Evaluating module://firebase.js.js
    Evaluating module://screens/LoginScreen.js.js
    Evaluating module://App.js.js
    Loading module://App.js`
  </code></pre>
  <p>Any help please ? Thanks</p>