I'm trying to use a router for my React application. I tried something I'd been using a while back, but can't seem to get it going. Has hashHistory
been removed/reformatted in React Router v4?
<Router history={hashHistory}>
<Route path='/' component={MainContainer} />
</Router>
Use a
HashRouter
. They got rid of individual histories such asbrowserHistory
andhashHistory
and instead replaced them withBrowserRouter
andHashRouter
components respectively in React Router v4:Note that
HashRouter
comes fromreact-router-dom
, not the corereact-router
package.