161
rated 0 times
[
166]
[
5]
/ answers: 1 / hits: 24228
/ 6 Years ago, mon, march 5, 2018, 12:00:00
I used same component for different routes. When route changes, I want the component to be rendered.
<Switch>
<Route exact path=/ component={HomePage} />
<Route path=/hotels component={HotelsPage} />
<Route path=/apartments component={HotelsPage} />
</Switch>
When I change the route path from /hotels
to /apartments
, the component HotelsPage
doesn't refresh.
What is the cool approach for this?
More From » reactjs