Is there a way in react router that whenever some components renders the url changes accordingly.
One way which I know is to place window.history.pushState('', '', '/componentUrl');
in the render function
of the component
Is there any better way to accomplish it within the route
other than path
props in Route
because path= 'someurl'
means whenever someurl
is accessed someComponent
should render
But in the other way round whenever someComponent
renders urls should change to someurl
I'm taking this senerio in context of conditional rendering inside a component
.