0

Now this might be sound silly question, but this happened to me twice. It was working before perfectly but after I renamed the file, it gives me error

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

Here's my structure.

* App.js
* src
  - screens
    - Main
      - index.js
      - Main.js

index.js

import Main from './Main';
export default Main;

Main.js

const Main = () => null;
export default Main;

App.js

import Main from './src/screens/Main/index';

I am using latest version of CRNA & EXPO. I know it has nothing to do with it, but still.

deadcoder0904
  • 7,232
  • 12
  • 66
  • 163

1 Answers1

0

I was importing another property in Main.js which did not exist like -

import { DoesNotExist } from './src/components/index';

So that was giving the error.

deadcoder0904
  • 7,232
  • 12
  • 66
  • 163