The project i am doing needs two layout, one homepage (which is right now app.js) and another result page. When the form is filled and submitted, the results should be shown in another layout(result layout not app). But when i submit the form, the url gets redirected to /car but the same app layout is shown.
Here is my code
app.js
class App extends Component {
render() {
return (
<div className="container-fluid">
<Nav
>
{this.props.children}
</Nav>
<Banner>
{ location.pathname === '/' || location.pathname === '/apartamentos' ||
location.pathname === '/coche' || location.pathname === '/experiencias' ?
this.props.children : ''
}
</Banner>
<Destinos />
<Footer />
</div>
);
}
}
result.js
const Result = (children) => <div>{children}</div>;
car-result.js
class CarResult extends Component {
render() {
return (
<div>
Car Result here
</div>
);
}
}
routes.js
export default (
<Route path="/" component={App}>
<IndexRoute component={Apartamentos} />
<Route path="coche" component={Coche} />
<Route path="experiencias" component={Experiencias} />
<Route path="login" component={Login} />
<Route component={Result}>
<Route path="car" component={CarResult} />
</Route>
</Route>
);