reactjs - firebase.default.auth 不是函数
问题描述
我是firebase的新手,我收到了这个错误。我正在尝试制作一个注册页面,但它不起作用。我究竟做错了什么?我从代码中删除了一些不重要的部分,但这是发生错误的部分。我的代码:
export default class Signup extends Component {
constructor() {
super();
this.state = {
displayName: '',
email: '',
password: '',
isLoading: false
}
}
updateInputVal = (val, prop) => {
const state = this.state;
state[prop] = val;
this.setState(state);
}
registerUser = () => {
if(this.state.email === '' && this.state.password === '') {
Alert.alert('Enter details to signup!')
} else {
this.setState({
isLoading: true,
})
//firebase.default.auth()
firebase.auth().createUserWithEmailAndPassword(this.state.email, this.state.password)
.then((res) => {
res.user.updateProfile({
displayName: this.state.displayName
})
console.log('User registered successfully!')
this.setState({
isLoading: false,
displayName: '',
email: '',
password: ''
})
this.props.navigation.navigate('Login')
})
.catch(error => this.setState({ errorMessage: error.message }))
}
}
解决方案
推荐阅读
- python - Python:实现扩张方法的问题
- php - PHP/Mysql:尝试为以前创建的子文件夹设置上传目录路径,其 id 如下:(upload/echo matriculation)
- java - 当一个方法在java中返回一个局部变量时会发生什么?局部变量是否延长了它的寿命?
- c++ - C++ 桌面应用程序与 Windows 10 日历应用程序的集成
- sql - 获取两个连接表的唯一记录数
- webpack - 编译失败。无效的文件签名:Expo React Native
- dataframe - 根据第一个数据帧从第二个数据帧获取数据
- c++ - OpenCV CV::Mat 图像到 AVFormat 视频编写器
- java - 出现错误:当我使用单独的流时,流已经被操作或关闭
- node.js - 如何使用 node.js {name} 更新谷歌驱动器文档中的特定文本