node.js - next.js + expo : You likely forgot to export your component from the file it's defined in, 或者您可能混淆了默认导入和命名导入

标签 node.js reactjs expo next.js

当我尝试运行 yarn ios 时,我得到:

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, or you might have mixed up default and named imports.

Check the render method of `MyApp`.

但是我的 App.tsx 有:


class MyApp extends App {


  render() {
    const { Component, pageProps } = this.props;
    return (
      <ThemeProvider theme={theme}>
        <ScrollView>
          <Component {...pageProps} />
        </ScrollView>
        <FooterBar />
      </ThemeProvider>
    )
  }
}

export default MyApp

所以我不确定它在提示什么?

最佳答案

尝试直接从其来源导入组件,然后插入 pageProp。所以在例子中:

import {Component} from '../pathOfComponent';

关于node.js - next.js + expo : You likely forgot to export your component from the file it's defined in, 或者您可能混淆了默认导入和命名导入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61492785/

相关文章:

node.js - 永远, Node : Strange upstart behavior (restart behaving same as stop)

javascript - reactjs 如何过滤/检查数组中的任何对象是否存在于另一个对象数组中?

javascript - 根据传递给组件的 Prop 分配样式组件 CSS 属性

ios - android上axios发布请求网络错误

node.js - 如何在 TypeScript 中增加 process.env?

arrays - JADE、Nodejs 和 JSON 数据渲染

node.js - Node JS : How do I read Body Parameters with Restify?

javascript - 使用 ReactJs 访问元素的输入值

使用 Expo 和 Firebase 的 iOS 应用奖励推荐

javascript - 如何在 Firestore 中排列数据以避免用户增加时出现性能问题