Following are the details for code snippet.
<Provider store={store}>
<MuiThemeProvider theme={customTheme}>
<Loader />
<Router>
<Switch>
<Route path="/" component={Layout} />
</Switch>
</Router>
</MuiThemeProvider>
</Provider>
答案 0 :(得分:0)
您无法制作页面以扩展布局组件吗?在这种情况下,登录组件将渲染布局组件并通过props操纵标题组件的显示。您可以将默认props设置为布局以匹配您的大多数子页面
布局
const Layout = props => (
<div className="layout-container">
{props.displayCommonHeader && <CommonHeaderComponent />}
{props.children}
</div>
)
登录
const Login = props => (
<Layout displayCommonHeader={false}>
<MyCustomLoginFormComponent />
</Layout>
)
某些子页面
const SomeSubpage = props => (
<Layout displayCommonHeader={true}>
Custom Stuff
</Layout>
)
希望对您有帮助!祝您好运!