firebase – 对象作为React子对象无效(找到的对象:带键的对象($
发布时间:2020-12-15 05:03:36 所属栏目:百科 来源:网络整理
导读:我正在尝试在我的本机应用程序上使用firebase.但它给出了一个错误. 我的App.js代码如下 import React,{ Component } from 'react';import { Text } from 'react-native';import firebase from 'firebase';export default class HelloWorldApp extends Compon
我正在尝试在我的本机应用程序上使用firebase.但它给出了一个错误.
我的App.js代码如下 import React,{ Component } from 'react'; import { Text } from 'react-native'; import firebase from 'firebase'; export default class HelloWorldApp extends Component { componentWillMount(){ firebase.initializeApp({ apiKey: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',authDomain: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',databaseURL: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',projectId: 'xxxxxxxxxxxxxxxxxxxx',storageBucket: 'xxxxxxxxxxxxxxxxxxxxxxxxxxx',messagingSenderId: 'xxxxxxxxxx' }) } render() { return ( <Text>Hello world!</Text> ); } } 我能做什么?谢谢
我今天遇到了这个问题.我在5.0.3和5.0.4之间的源代码上运行了差异,发现导出已经改变.我还发现,如果我将import语句更改为以下版本,它将与最新版本(5.3.0)一起使用:
从’@ firebase / app’导入firebase 如果你正在使用eslint,你可能会抱怨它应该列在项目依赖项中,但你可以忽略它. 您可能还想使用firebase的实际功能而不仅仅是核心导入.例如,要使用身份验证模块,您需要添加以下内容: 导入’@ firebase / auth’ (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |