Element type is invalid: expected string or class but got undefined

I am working on a tutorial and encountered the following error and iOS simulator.

Element type is invalid: expected a string (for built-in components) 
but got: undefined. You likely forgot to export your component from 
the file it’s defined in.

      

In life, I cannot understand what is happening. I tried to import both {LoginForm} and LoginForm but doesn't work. If I comment {/*<LoginForm />*/}

in App.js it works great.

index.ios.js

import { AppRegistry } from 'react-native';
import App from './src/App';

AppRegistry.registerComponent('accessss', () => App);

      

App.js

import React, { Component } from 'react';
import { View, Text } from 'react-native';
import LoginForm, { Header } from './components';
import firebase from 'firebase';
const config = require('./../config/firebase.config.js');

class App extends Component {

    componentWillMount() {
        firebase.initializeApp(config);
    }

    render() {
        return(
            <View>
                <Header headerText="Authentication" />
                <LoginForm />
            </View>
        );
    }
}

const styles = {


};

export default App;

      

LoginForm.js

import React, { Component } from 'react';
import { View } from 'react-native';
import { Button, Card, CardSection } from './';

class LoginForm extends Component {
    render() {
        return(
            <View>

            </View>
        );
    }
}

export default LoginForm;

{/* Also tried export { LoginForm }; */}

      

I don't understand what I am doing wrong. I am exporting 4 other components and they work fine.

+3


source to share





All Articles