我正在学习如何在 React 应用程序中使用 firebase 身份验证,并且遇到了这个问题。有人可以帮助我吗?
我已经使用 npm 安装了 firebase。这是我的 firebase.js 文件。
import { initializeApp } from "firebase/app";
import 'firebase/auth'
const firebaseConfig = {
apiKey: "AIzaSyA_89k1bt6Z2_1lVLb_Vwn5OL9_GgTNQEQ",
authDomain: "auth-development-59396.firebaseapp.com",
projectId: "auth-development-59396",
storageBucket: "auth-development-59396.appspot.com",
messagingSenderId: "1003786595756",
appId: "1:1003786595756:web:fa93ae00e49a4c04c49e09"
};
const app = initializeApp(firebaseConfig);
export const auth = app.auth()
export default app
Run Code Online (Sandbox Code Playgroud)
这是依赖项 package.json 文件。
"dependencies": {
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.8.3",
"bootstrap": "^5.1.1",
"firebase": "^9.0.2",
"react": "^17.0.2",
"react-bootstrap": "^1.6.3",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
"web-vitals": "^1.1.2"
}
Run Code Online (Sandbox Code Playgroud)