簡體   English   中英

'firebase' 未定義 no-undef

[英]'firebase' is not defined no-undef

我正在使用 Google 和 Facebook 構建一個帶有 Firebase 身份驗證的登錄頁面。 請在下面找到代碼片段和錯誤消息。

import {GoogleOutlined,FacebookOutlined} from '@ant-design/icons';
import {auth} from '../firebase';
import "firebase/app";


const Login = () => {
   
    
    return (
   
   <div id="login-page"> 
            <div id="login-card">
               
               <h2>Welcome to PryChat !</h2>

               <div className="login-button google"
               onClick={()=>auth.signInWithRedirect(new firebase.auth.GoogleAuthProvider())}>

<GoogleOutlined /> Sign In with Google 
               </div>

<br></br>

<div className="login-button facebook" onClick={()=>auth.signInWithRedirect(new firebase.auth.FacebookAuthProvider())}>
<FacebookOutlined /> Sign In with Facebook 
               
               </div>
            </div>
   </div>
   
   );
}

export default Login

在此處輸入圖像描述

我無法發表評論,但您是否安裝了正確版本的 firebase? 如果您安裝了 v9(最新的模塊化版本),它可能無法正常工作,因為您使用的是 v8 語法。

嘗試查看GoogleFacebook文檔中的 v9 語法,並確保使用正確的版本。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM