我有以下HOC:
export default (keys: Array) => (WrappedComponent: React.Component<*, *, *>) => (props: Object): React.Element<*> => { if (hasNotYetLoadedProps(keys, props)) { return ( ) } returnLoading}
要么渲染原始组件,要么加载指示器.使用实际的流类型声明我得到这个错误:
React element `WrappedComponent`. Expected React component instead of React$Component
在最后一行.输入组件的正确类型是什么?
类型需要 ReactClass
export default (keys: Array) => (WrappedComponent: ReactClass ) => (props: Object): React.Element<*> => { if (hasNotYetLoadedProps(keys, props)) { return ( ) } returnLoading}