[英]Error in default export React Native using CRNA/Expo?
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
import Main from './Main';
export default Main;
const Main = () => null;
export default Main;
import Main from './src/screens/Main/index';
I am using latest version of CRNA & EXPO. 我正在使用最新版本的CRNA和EXPO。 I know it has nothing to do with it, but still.
我知道它与它无关,但仍然如此。
I was importing another property in Main.js
which did not exist like - 我正在
Main.js
导入另一个不存在的属性-
import { DoesNotExist } from './src/components/index';
So that was giving the error. 所以这就是错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.