2020-08-17 21:07:16 +01:00
|
|
|
import React from 'react'
|
2020-08-17 21:59:29 +01:00
|
|
|
import PropTypes from 'prop-types'
|
2020-08-12 23:52:46 +01:00
|
|
|
import Bundle from './bundle'
|
|
|
|
|
2020-08-17 21:07:16 +01:00
|
|
|
class WrappedBundle extends React.PureComponent {
|
2020-08-12 23:52:46 +01:00
|
|
|
|
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
component,
|
|
|
|
componentParams,
|
|
|
|
errorComponent,
|
|
|
|
loadingComponent,
|
|
|
|
} = this.props
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Bundle
|
|
|
|
fetchComponent={component}
|
|
|
|
loading={loadingComponent}
|
|
|
|
error={errorComponent}
|
|
|
|
>
|
|
|
|
{
|
|
|
|
Component =>
|
|
|
|
(
|
|
|
|
<Component {...componentParams} />
|
|
|
|
)
|
|
|
|
}
|
|
|
|
</Bundle>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
WrappedBundle.propTypes = {
|
|
|
|
component: PropTypes.func.isRequired,
|
|
|
|
componentParams: PropTypes.object,
|
|
|
|
errorComponent: PropTypes.object,
|
|
|
|
loadingComponent: PropTypes.object,
|
|
|
|
}
|
|
|
|
|
|
|
|
export default WrappedBundle
|