reactjs - 错误:元素类型无效:需要一个字符串(用于内置组件)或一个类/函数,以防服务器端使用 react 渲染
问题描述
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
我在尝试使用<Navbar/>
外部组件<Switch>
(react-router-dom)时遇到这个问题,以防在进行服务器端渲染时使用 react-helmet。
解决方案
推荐阅读
- android - 视频结束后视频视图变黑且无法重播
- asp.net-core - 部署到 Server 2019 上的 IIS 时,asp.net 5 中的 ILogger 无法正常工作
- html - 创建一个漂亮的圆角桌
- c# - 当我更新我的 Nugets 时使用简单容器的 c# 问题
- go - 为什么 leveldb 错误仅出现在 10% 的测试运行中以及如何解决?
- c++ - 命名空间、包含、一个解决方案中的多个项目以及 cpp 中的模块的位置
- macos - OSX Mojave 重启失败
- dart - 为什么在 Dart 中要避免 lambdas 绑定到命名变量(根据有效 Dart)?
- google-sheets - 将唯一值与主数据集匹配并运行计算
- c# - 检查当前循环迭代是否大于前一个