Answer the question
In order to leave comments, you need to log in
How to create multiple layouts with React Router 4 (react-router-dom)?
Can't create 2 different Layouts in new version of React-Router
Help
Answer the question
In order to leave comments, you need to log in
Thanks everyone
The solution is:
<Switch>
<Layout exact path="/properties" component={Properties} />
<Layout path="/properties/:id" component={Property} />
</Switch>
const Layout = ({component: Component, ...rest}) => {
return (
<Route {...rest} render={matchProps => (
<div className="container-fluid flex-wrap justify-content-center d-flex layout flex-column" style={{ minHeight: '100vh', background: rest.white ? 'white' : '#eceff1' }}>
<Header />
<div style={{ flex: 1 }}>
<Component {...matchProps} />
</div>
<Footer />
</div>
)} />
)
};
export default Layout;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question