3

我在使用某个 ant-design 组件时遇到问题:Dropdown。

源代码是用 ES6 编写的,使用 Babel 可以很好地编译。加载页面时,抛出如下错误,页面未渲染:

Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object. Check the render method of `Dropdown`.
    in Dropdown (created by Dropdown)
    in Dropdown (created by DashboardTemplate)
    in div (created by Col)
    ...

我正在使用此Gist中列出的代码,该代码运行良好,但由于某些软件包已更新,因此无法正常工作。我无法通过降级所有包来重现工作版本,因为依赖项的依赖项仍然更新到更新版本。我也无法在 Codepen 示例中重现该问题。

Dropdown是一个 ant-design 组件,按照 ant-design 文档中的说明使用。

任何线索可能导致此错误?

Webpack 用作捆绑器,安装的包版本为:

$ npm ls antd react react-router react-dom prop-types webpack
E:\dashboard
+-- antd@2.11.2
+-- laravel-elixir-webpack-official@1.0.10
| +-- webpack@2.1.0-beta.22
| `-- webpack-stream@3.2.0 (git://github.com/jeroennoten/webpack-stream.git#d78a3568e259f9cdbc64c60290639af6ef6d3baf)
|   `-- webpack@1.15.0
+-- prop-types@15.5.10
+-- react@15.6.1
+-- react-dom@15.6.1
+-- react-icons@2.2.5
| `-- react-icon-base@2.0.7
|   `-- prop-types@15.5.8
+-- react-router@3.0.5
`-- webpack@2.6.1

谢谢!

4

0 回答 0