小编Lui*_*ulo的帖子

其实例类型“BrowserRouter”不是有效的 JSX 元素

我正在开发一个使用 React + coreui 开发的项目,该项目一直运行良好。然而,上周我在部署修改时遇到了一个莫名其妙的问题。

18:03:11  Creating an optimized production build...
18:04:32  Failed to compile.
18:04:32  
18:04:32  /var/lib/jenkins/workspace/deploy-sandbox/src/AppRouter.tsx
18:04:32  Type error in /var/lib/jenkins/workspace/deploy-sandbox/src/AppRouter.tsx(47,6):
18:04:32  'Router' cannot be used as a JSX component.
18:04:32    Its instance type 'BrowserRouter' is not a valid JSX element.
18:04:32      The types returned by 'render()' are incompatible between these types.
18:04:32        Type 'React.ReactNode' is not assignable to type 'import("/var/lib/jenkins/workspace/deploy-sandbox/node_modules/@types/react-transition-group/node_modules/@types/react/index").ReactNode'.  TS2786
18:04:32  
18:04:32      45 | 
18:04:32      46 |   return (
18:04:32    > 47 |     <Router>
18:04:32         | …
Run Code Online (Sandbox Code Playgroud)

jsx reactjs core-ui

12
推荐指数
1
解决办法
2万
查看次数

标签 统计

core-ui ×1

jsx ×1

reactjs ×1