Updated panels to be async_components
• Updated: - panels to be async_components • Added: - WrappedBundle
This commit is contained in:
40
app/javascript/gabsocial/features/ui/util/wrapped_bundle.js
Normal file
40
app/javascript/gabsocial/features/ui/util/wrapped_bundle.js
Normal file
@@ -0,0 +1,40 @@
|
||||
import Bundle from './bundle'
|
||||
|
||||
class WrappedBundle extends PureComponent {
|
||||
|
||||
render() {
|
||||
const {
|
||||
component,
|
||||
componentParams,
|
||||
errorComponent,
|
||||
loadingComponent,
|
||||
} = this.props
|
||||
|
||||
console.log("WrappedBundle:", 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
|
||||
Reference in New Issue
Block a user