最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - TypeError: undefined is not an object 'createElement' of undefined - React Native - Stack Overflow

programmeradmin5浏览0评论

I have a LoginForm.js ponent

import { React, Component } from 'react';
import { Button, Card, CardSection } from './mon';

class LoginForm extends Component {
    render() {
        return (
            <Card>
                <CardSection />

                <CardSection />

                <CardSection>
                    <Button>
                        Login
                    </Button>
                </CardSection>


            </Card>
        );
    }

}

export default LoginForm;

I tried to integrate it into my App.js like this

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

import { Header } from './ponents/mon';
import LoginForm from './ponents/LoginForm';


class App extends Component {


    ponentWillMount() {
        firebase.initializeApp({
            apiKey: '*********',
            authDomain: 'rn-auth-a3fb5.firebaseapp',
            databaseURL: '',
            projectId: 'rn-auth-a3fb5',
            storageBucket: 'rn-auth-a3fb5.appspot',
            messagingSenderId: '34567890'
        });
    }
    render() {
        return (
            <View>
                <Header headerText='Authentication' />
                <LoginForm />

            </View>

        );
    }
}
export default App;

I kept getting an error

TypeError: Cannot read property 'createElement' of undefined

This error is located at: in LoginForm (at App.js:26) in RCTView (at View.js:43) in App (at renderApplication.js:32) in RCTView (at View.js:43) in RCTView (at View.js:43) in AppContainer (at renderApplication.js:31)

Which I expect to get something like this

How would one go about debugging this further?

I have a LoginForm.js ponent

import { React, Component } from 'react';
import { Button, Card, CardSection } from './mon';

class LoginForm extends Component {
    render() {
        return (
            <Card>
                <CardSection />

                <CardSection />

                <CardSection>
                    <Button>
                        Login
                    </Button>
                </CardSection>


            </Card>
        );
    }

}

export default LoginForm;

I tried to integrate it into my App.js like this

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

import { Header } from './ponents/mon';
import LoginForm from './ponents/LoginForm';


class App extends Component {


    ponentWillMount() {
        firebase.initializeApp({
            apiKey: '*********',
            authDomain: 'rn-auth-a3fb5.firebaseapp.',
            databaseURL: 'https://rn-auth-a3fb5.firebaseio.',
            projectId: 'rn-auth-a3fb5',
            storageBucket: 'rn-auth-a3fb5.appspot.',
            messagingSenderId: '34567890'
        });
    }
    render() {
        return (
            <View>
                <Header headerText='Authentication' />
                <LoginForm />

            </View>

        );
    }
}
export default App;

I kept getting an error

TypeError: Cannot read property 'createElement' of undefined

This error is located at: in LoginForm (at App.js:26) in RCTView (at View.js:43) in App (at renderApplication.js:32) in RCTView (at View.js:43) in RCTView (at View.js:43) in AppContainer (at renderApplication.js:31)

Which I expect to get something like this

How would one go about debugging this further?

Share Improve this question edited May 25, 2019 at 6:09 halfer 20.4k19 gold badges109 silver badges202 bronze badges asked Jul 13, 2018 at 2:13 code-8code-8 58.9k120 gold badges391 silver badges670 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 10

Your React import in LoginForm.js is incorrect. React should be the default import.

import React, { Component } from 'react';
发布评论

评论列表(0)

  1. 暂无评论