I have 2 routes which render the same component.
Once I am on route path "/route1", I click on a link which routes me to /route2. I expect componentWillUnmount() to be called but instead the render method is called again with prop type "type2". Why is this happening?
I have already tried adding a key to each Route but it does not work.
`<Switch>
<Route
path={'/route1'}
render={props => (
<Component1
type={type1}
{...props}
/>
)}
/>
<Route
path={'/route2'}
render={props => (
<Component1
type={type2}
{...props}
/>
)}
/>
</Switch>`