Accepted answer

If using the newer react-router API, you need to make use of the history from this.props when inside of components so:


However this may be only used to change the URL programatically, not to actually navigate to the page. You should have some mapping of component to this URL inside your router config file like this.

            <Route path="/some/path" component={SomeComponent} />
            <Route path="/" component={IndexComponent} />

Hope this helps. Happy Coding !

Related Query

More Query from same tag