我需要帮助,我正在观看 Firebase 的教程并做出反应。然后我意识到该教程是针对 v8 的,而最新的是 v9
这是我的 firebase.js
import { initializeApp } from 'firebase/app';
import { getAuth } from 'firebase/auth';
import { getDatabase } from "firebase/database";
const firebaseConfig = {
//firebaseconfig
};
const app = initializeApp(firebaseConfig);
const auth = getAuth(app);
const database = getDatabase(app);
export { auth, database }
然后这是我的 signin.js 代码段
import { auth, database } from "../Firebase/firebase";
const submitForm = async (values) => {
auth()
.signInWithEmailAndPassword(values.email,values.password)
.then((userCredentials) => {
props.history.push("/profile");
}).catch((err) => {
setLoading(false);
});
};
然后当我提交表单时,应用程序在 auth() 上出现错误并崩溃。
Unhandled Rejection (TypeError): Object(...) is not a function