【发布时间】:2018-05-01 12:48:52
【问题描述】:
我正在尝试使用 react-loadable 将代码拆分引入我的应用程序。我在一个非常简单的组件上试了一下:
const LoadableComponent = Loadable({
loader: () => import('components/Shared/Logo/Logo'),
loading: <div>loading</div>,
});
但是,当这个组件被渲染时,我得到了以下错误:
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 `LoadableComponent`.
in LoadableComponent (created by AppHeader)
in div (created by AppHeader)
in AppHeader (created by PlainChatApp)
in div (created by PlainChatApp)
in PlainChatApp (created by DragDropContext(PlainChatApp))
in DragDropContext(PlainChatApp) (created by Connect(DragDropContext(PlainChatApp)))
in Connect(DragDropContext(PlainChatApp))
in Provider
in AppContainer
in ErrorBoundary
The above error occurred in the <LoadableComponent> component:
in LoadableComponent (created by AppHeader)
in div (created by AppHeader)
in AppHeader (created by PlainChatApp)
in div (created by PlainChatApp)
in PlainChatApp (created by DragDropContext(PlainChatApp))
in DragDropContext(PlainChatApp) (created by Connect(DragDropContext(PlainChatApp)))
in Connect(DragDropContext(PlainChatApp))
in Provider
in AppContainer
in ErrorBoundary
我没有看到任何明显的错误,我无法在该回购中提出问题。
【问题讨论】:
标签: reactjs code-splitting react-loadable