简体   繁体   English

在 react js 中初始化 firebase 应用程序显示错误

[英]Initialize firebase app in react js shows error

I'm trying to initialize firebase app in my coreui admin panel react js.我正在尝试在我的 coreui 管理面板 react js 中初始化 firebase 应用程序。 I don't know how to initialize it.我不知道如何初始化它。 I have my credentials in firebaseconfigure.js .我在firebaseconfigure.js中有我的凭据。

And I imported it in login.js.我将它导入到 login.js 中。

import 'firebase/auth';
import firebaseConfig from './firebaseConfig'

firebase.auth().signInWithEmailAndPassword(this.state.email, this.state.password).then((user) => {
alert(user);

But It not showing anything.但它没有显示任何东西。 why?为什么?

You forgot to initialize the firebase.initialize() .您忘记初始化firebase.initialize()

In your login.js file, add this following line after import .在您的login.js文件中,在import之后添加以下行。

const firebaseApp = firebase.initializeApp(firebaseConfig);

Now check it again in login page.现在在登录页面再次检查。 and let me know.让我知道。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 每当我尝试在 next.js 中初始化架构时,它都会显示错误 - Whenever I try to initialize schema in next.js it shows error React 应用程序生产版本显示 js 错误 - React app production build shows js errors 我在哪里初始化 React 应用程序中的 Firebase 应用程序? - Where do I initialize Firebase app in React application? 将Firebase集成到React App中时出错 - Error integrating firebase into react app 如何解决错误:无法实例化 firebase-messaging.js - 请务必先加载 firebase-app.js。 在反应应用程序中 - how to solve Error: Cannot instantiate firebase-messaging.js - be sure to load firebase-app.js first. in react app Firebase 和 React 托管 - 不加载 App.js - Firebase and React hosting - not loading App.js 类型错误:firebase.firestore 不是反应 js 和 firebase 应用程序中的 function - TypeError: firebase.firestore is not a function in react js and firebase app React + Firebase 应用程序和 auth.esm.js:255 的网络错误,同时尝试使用 Google 登录 - React + Firebase app and Network Error at auth.esm.js:255 while trying to sign in with Google React.js / Firebase 应用程序中的 Axios 错误(404):POST http://localhost:3000/login 404(未找到) - Axios error (404) in React.js / Firebase app: POST http://localhost:3000/login 404 (Not Found) Create React App 中 httpsCallable firebase 上的 CORS 错误 - CORS error on httpsCallable firebase in Create React App
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM