使用CRNA / Expo默认导出React Native时出错?

时间:2017-11-01 07:46:35

标签: javascript react-native expo create-react-native-app

现在这可能是个愚蠢的问题,但这件事发生在我身上两次。它完美地工作,但在我重命名文件后,它给了我错误

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.

这是我的结构。

* 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';

我正在使用最新版本的CRNA& EXPO。我知道它与它无关,但仍然。

1 个答案:

答案 0 :(得分:0)

我在Main.js中导入了另一个不存在的属性,如 -

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

所以这就是错误。

相关问题