I\'m pulling my hair out trying to render multiple layouts with React Router v4.
For instance, I\'d like pages with the following paths to have layout 1:
I know i am replying late but it's easy to do that, i hope it will helps to newbie. i am using React 4
Layout.js
export default props => (
{props.children}
);
LoginLayout.js
export default props => (
{props.children}
);
Now finally we have our App
App.js
function renderWithLoginLayout(Component, Layout) {
return
}
function renderWithLayout(Path, Component, Layout) {
return
}
export default () => (
renderWithLayout(this.path, Home, Layout)} />
renderWithLayout(this.path, Counter, Layout)} />
renderWithLayout(this.path, FetchData, Layout)} />
renderWithLoginLayout(Login, LoginLayout)} />
);