29 lines
617 B
JavaScript
29 lines
617 B
JavaScript
import React from "react"
|
|
import PropTypes from "prop-types"
|
|
|
|
export default class App extends React.Component {
|
|
|
|
getLayout() {
|
|
let { getComponent, layoutSelectors } = this.props
|
|
const layoutName = layoutSelectors.current()
|
|
const Component = getComponent(layoutName, true)
|
|
return Component ? Component : ()=> <h1> No layout defined for "{layoutName}" </h1>
|
|
}
|
|
|
|
render() {
|
|
const Layout = this.getLayout()
|
|
|
|
return (
|
|
<Layout/>
|
|
)
|
|
}
|
|
}
|
|
|
|
App.propTypes = {
|
|
getComponent: PropTypes.func.isRequired,
|
|
layoutSelectors: PropTypes.object.isRequired,
|
|
}
|
|
|
|
App.defaultProps = {
|
|
}
|