'react-router' does not contain an export named 'hashHistory'.
The <HashRouter> creates a hash history for you. For most projects, that should be all you need to do.
import { HashRouter } from 'react-router-dom';
ReactDOM.render((
<HashRouter>
<App />
</HashRouter>
), holder);
If you need to access the history object outside of your components, you will need to create your own history object and pass it to the <Router>.
// history.js
import { createHashHistory } from 'history';
export default createHashHistory();
// index.js
import { Router } from 'react-router-dom';
import history from './history';
ReactDOM.render((
<Router history={history}>
<App />
</Router>
), holder);
Most helpful comment
The
<HashRouter>creates a hash history for you. For most projects, that should be all you need to do.If you need to access the
historyobject outside of your components, you will need to create your ownhistoryobject and pass it to the<Router>.