Reactjs Firebase身份验证预期`onClick`侦听器是一个函数,而得到的是`object`类型的值
在我的React项目上设置Firebase身份验证期间。 我无法在单击按钮时使Auth弹出触发器 它在单击按钮后在控制台内抛出错误,或者在刷新页面后自动打开身份验证 (预期Reactjs Firebase身份验证预期`onClick`侦听器是一个函数,而得到的是`object`类型的值,reactjs,firebase,authentication,firebase-authentication,Reactjs,Firebase,Authentication,Firebase Authentication,在我的React项目上设置Firebase身份验证期间。 我无法在单击按钮时使Auth弹出触发器 它在单击按钮后在控制台内抛出错误,或者在刷新页面后自动打开身份验证 (预期onClicklistener是一个函数,但得到的值是objecttype。) 这是我的组成部分: import React,{Component}来自“React”; 从“react redux”导入{connect}; 使用Google从“../../firebase”导入登录; 类头扩展组件{ 建造师(道具){ 超级(道
onClick
listener是一个函数,但得到的值是object
type。)
这是我的组成部分:
import React,{Component}来自“React”;
从“react redux”导入{connect};
使用Google从“../../firebase”导入登录;
类头扩展组件{
建造师(道具){
超级(道具);
}
render(){
console.log(this.props);
返回(
登录
);
}
}
const mapStateToProps=state=>state;
导出默认连接(MapStateTops)(标题);
正如您所看到的,登录按钮应该使用Firebase中的Google arrow函数触发SigninWith,但它会在单击时抛出一个错误 我认为问题在于,您正在从“../../firebase”导入默认导出,即“firebase”,而不是登录功能 要解决此问题,只需将花括号{}添加到导入中,以便导入命名的导出而不是默认导出:
import { signInWithGoogle } from "../../firebase";
我认为问题在于您正在从“../../firebase”导入默认导出,这是“firebase”,而不是登录函数 要解决此问题,只需将花括号{}添加到导入中,以便导入命名的导出而不是默认导出:
import { signInWithGoogle } from "../../firebase";
import { signInWithGoogle } from "../../firebase";