我正在使用react and react-dom 16.5.0。
我将react-dropzone从3.13.0升级到了5.1.0。
我的页面无法呈现,而是在控制台中获取它:
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 `Upload`.
Uncaught Error: Element 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 `Upload`.
at invariant (react-dom.development.js:55)
at createFiberFromElement (react-dom.development.js:9823)
at reconcileSingleElement (react-dom.development.js:12777)
at reconcileChildFibers (react-dom.development.js:12834)
at reconcileChildren (react-dom.development.js:13238)
at finishClassComponent (react-dom.development.js:13412)
at updateClassComponent (react-dom.development.js:13356)
at beginWork (react-dom.development.js:13945)
at performUnitOfWork (react-dom.development.js:16249)
at workLoop (react-dom.development.js:16287)
上面提到的Upload文件包含我的元素。
进一步的实验表明,直到4.1.3的版本都可以使用,但是4.2.0及更高版本失败了。
react-dropzone 4.2.0唯一列出的功能是“添加es2015模块构建”。没有列出重大更改。