0

I have a few routes such as:

<Route exact={true} path="/" component={Home} />
<Route path="/parent" component={withoutRouting(Parent)} />
<Route path="/parent/*" component={withoutRouting(Child)} />

When going to the child route (parent/any-child) the Parent component's html is rendered in addition to the Child component's html, where the expected behavior is only the Child component's html should be rendered.

I have used react once before and don't remember ever encountering this. What are the common causes for this behavior, I'm assuming I am just doing something incorrect.

shell
  • 1,647
  • 2
  • 17
  • 31
  • React router renders all the components that matches the route, so in this case if parent is matching the route, it will render too. – mindaJalaj Aug 25 '17 at 06:49
  • I see, thanks. I suppose my question is more in line with this one: - which already has an answer. I will leave this question open for future visitors. – shell Aug 25 '17 at 06:54
  • Possible duplicate of [Why does React Router renders multiple routes](https://stackoverflow.com/questions/43994510/why-does-react-router-renders-multiple-routes) – Shubham Khatri Aug 25 '17 at 08:00

0 Answers0