React Native Expo App New Component Error

සුදු පුතා

Well-known member
  • Jul 4, 2014
    1,187
    644
    113
    වලස්ගුහාව.
    I'm new to react-native so try to study. I tried to make new component for my app after that I go to run my react native app on my iPhone Expo this error displayed in red background area.

    Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it's defined in.
    this is the App.js inside the 'src/components/' folder

    Code:
    import React, { Component } from 'react';
    import { View, Text } from 'react-native';
    
    export default class App extends Component {
      render() {
        return (
        	<View>
          		<Text>Hello</Text>
          	</View>
        );
      }
    }

    This is the main App.js in react-native app folder.

    Code:
    import App from './src/components/App';

    I used expo app for run this code. How can I solve this error?