I am trying to implement firebase authentication in my project. However, I'm getting the error Firebase.auth() is not a function. Does anyone know why this is happening?
App.js
import { initializeApp } from 'firebase/app';
import * as firebase from "firebase/app";
const firebaseConfig = {
apiKey: "",
authDomain: "",
projectId: "",
storageBucket: "",
messagingSenderId: "",
appId: ""
};
firebase.initializeApp(firebaseConfig);
js
import React from "react";
import * as firebase from "firebase/app";
export const loginRequest = (email, password) =>
firebase.auth().signInWithEmailAndPassword(email, password);
use
import auth from '@react-native-firebase/auth';
instead.
or
import * as firebase from '@react-native-firebase';
You are trying to use the App library for everything. It only works as the App library.