简体   繁体   English

导入时“对象无效,无法作为React子代使用”

[英]“Objects are not valid as a React Child” on imports

import React, { Component } from 'react';
import { View, Text } from 'react-native';
import Firebase from 'firebase';

class App extends Component {
    render() {
        return (
            <View>
                <Text>App</Text>
            </View>
        )
    }
}

export default App;

So this code is crashing because of the import Firebase from 'firebase' I used 'npm install --save firebase' and I did 'npm link firebase' and firebase is in package.json, but that import is still crashing it. 所以这段代码崩溃是因为从'firebase'导入了Firebase我使用了'npm install --save firebase'并且我做了'npm link firebase'并且firebase在package.json中,但是该导入仍然使它崩溃。 Anyone know why? 有人知道为什么吗? I saw some people just created a variable for firebase, but it does this for all imports and I also need to add a google sign in import, which also crashed my app. 我看到有人刚刚为firebase创建了一个变量,但是它为所有导入创建了变量,并且我还需要在import中添加一个google登录,这也使我的应用程序崩溃了。

Configure firebase before running the app. 在运行应用程序之前配置Firebase。 Check the following link to configure firebase in Android or iOS. 检查以下链接以在Android或iOS中配置Firebase。

https://rnfirebase.io/docs/v4.2.x/installation/android https://rnfirebase.io/docs/v4.2.x/installation/ios https://rnfirebase.io/docs/v4.2.x/installation/android https://rnfirebase.io/docs/v4.2.x/installation/ios

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

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