Am trying to configure two routes in my application ... one for product page and the other for search results, I tried to do as follow
<Router>
<Switch>
<Route exact path="/" component={Home} />
<Template>
<Route exact path="/search" component={SearchResult} />
<Route path="/:id" component={PropertyTemplate} />
</Template>
</Switch>
</Router>
Template
class Template extends React.Component {
constructor(props) {
super(props)
this.state = {
property: null
}
}
render() {
return (
<div>
{/* HEADER */}
<Header></Header>
{/* HEADER */}
{/* LEFT SIDE */}
<LeftSide></LeftSide>
{/* LEFT SIDE */}
<div id="wrapper">
{this.props.children}
</div>
</div >
)
}
}
export default Template;
but it's not working, both components of /search and /:id are executed
note : id is alphanumeric
Templatecomponent?