简体   繁体   English

组件异常元素类型无效

[英]Component exception Element type is invalid

So I'm having an error that I have no idea where it coming from:所以我有一个错误,我不知道它来自哪里:

我得到的错误

I tried finding where is HeaderSegment but it doesn't exist in my project, I don't have-我试着找到HeaderSegment在哪里,但它不存在于我的项目中,我没有-

import HeaderSegment from './example.js'

I did the usual searched in google but the problem in these answers that I don't have any import module that is HeaderSegment .我在谷歌中进行了通常的搜索,但这些答案中的问题是我没有任何导入模块HeaderSegment I'm using React native, Admob and Firebase, and I don't really know where the error is located so here the Repo.我正在使用 React native,Admob 和 Firebase,我真的不知道错误在哪里,所以这里是Repo。 I tried to remove node_modules and then npm install but no good, here the stack:我尝试删除node_modules然后安装 npm 但没有用,这里是堆栈:

堆

(Ofcourse that doesn't work) I know it hard to answer this question there two files involved they are header.js and homeStack.js. (当然这不起作用)我知道很难回答这个问题,因为涉及两个文件,它们是 header.js 和 homeStack.js。 Any help will make me happy, Thank you.任何帮助都会让我开心,谢谢。

Issue问题

Seems you have mixed up default and named imports of your Header component.似乎您混淆了Header组件的默认导入和命名导入。

Header is default exported from header.js : Header默认从header.js导出:

export default Header;

but imported as a named import in homeStack.js :但在homeStack.js中作为命名导入导入:

import { Header } from '../shared/header';

Solution解决方案

Fix the Header export to match how it's imported (named export/import):修复Header导出以匹配它的导入方式(命名为导出/导入):

export Header;

or fix the Header import to match how it's exported (default export/import):或修复Header导入以匹配它的导出方式(默认导出/导入):

import Header from '../shared/header';

So I'm having an error that I have no idea where it coming from:所以我有一个错误,我不知道它来自哪里:

我得到的错误

I tried finding where is HeaderSegment but it doesn't exist in my project, I don't have-我试图找到HeaderSegment在哪里,但它在我的项目中不存在,我没有 -

import HeaderSegment from './example.js'

I did the usual searched in google but the problem in these answers that I don't have any import module that is HeaderSegment .我在谷歌中进行了通常的搜索,但这些答案中的问题是我没有任何导入模块,即HeaderSegment I'm using React native, Admob and Firebase, and I don't really know where the error is located so here the Repo.我正在使用 React native、Admob 和 Firebase,我真的不知道错误在哪里,所以这里是Repo。 I tried to remove node_modules and then npm install but no good, here the stack:我试图删除node_modules然后 npm 安装但不好,这里是堆栈:

堆

(Ofcourse that doesn't work) I know it hard to answer this question there two files involved they are header.js and homeStack.js. (当然这不起作用)我知道很难回答这个问题,因为涉及两个文件,它们是 header.js 和 homeStack.js。 Any help will make me happy, Thank you.任何帮助都会让我开心,谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM