reactjs – React and Firebase authentication system


import firebase from "firebase/app";
import "firebase/auth";

const firebaseConfig = {
  apiKey: process.env.REACT_APP_API_KEY,
  authDomain: process.env.REACT_APP_AUTHDOMAIN,
  databaseURL: process.env.REACT_APP_BASEURL,
  projectId: process.env.REACT_APP_PROJECT_ID,
  storageBucket: process.env.REACT_APP_STORAGEBUCKET,
  messagingSenderId: process.env.REACT_APP_MESSAGING_SENDER_ID,
  appId: process.env.REACT_APP_APP_ID,
  measurementId: process.env.REACT_APP_MEASUREMENT_IDenter code here
};

// Initialize Firebase
const fire= firebase.initializeApp(firebaseConfig);
const firebaseAuth = firebase.auth();

export default fire;

So this is my firebase.js file and I’m trying to use the authentication system, but it’s not working and I’m getting this error “TypeError: firebase__WEBPACK_IMPORTED_MODULE_6_.default.auth.onAuthStateChanged is not a function”. Also I have imported the firebase file everywhere I’m using it so I’m nto sure what’s wrong because for some reason obviously I can’t access the auth functions.

Any help is appreciated”!!