简体   繁体   English

'firebase' 未定义 no-undef

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

I was building a sign in page with firebase authentication using Google and Facebook.我正在使用 Google 和 Facebook 构建一个带有 Firebase 身份验证的登录页面。 Kindly find the code snippet and error message below.请在下面找到代码片段和错误消息。

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

在此处输入图像描述

I can't comment but have you installed the correct version of firebase?我无法发表评论,但您是否安装了正确版本的 firebase? If you have v9 installed (the latest, modular version) it probably isn't working because you're using the v8 syntax.如果您安装了 v9(最新的模块化版本),它可能无法正常工作,因为您使用的是 v8 语法。

Try looking at the v9 syntax in the documentation for Google and Facebook and make sure you use the correct version.尝试查看GoogleFacebook文档中的 v9 语法,并确保使用正确的版本。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM