history
history copied to clipboard
blank page when pushing to hash history after upgrading from v4 to v5
Did something change for v5? Am I missing something?
If I go back to 4.10.1, pushing a path to history works fine, in v5 it gives me a blank page. If then I reload the browser, only then it shows the page.
index.js
import { Route, Router, Switch } from 'react-router-dom';
import Home from '../../views/home/home';
import Login from '../../views/login/login';
import routerHistory from './routerHistory';
import { Provider } from 'react-redux';
import store from '../redux/store';
import GlobalStyle from '../styles/styles'
//Routes
export default function Routes() {
return (
<Provider store={store}>
<Router history={routerHistory}>
<Switch>
<Route path="/" exact component={Home} />
<Route path="/login" component={Login}/>
</Switch>
<GlobalStyle />
</Router>
</Provider>
);
}
routerHistory.js
import { createHashHistory } from 'history';
export default createHashHistory();
in some file:
import routerHistory from '../../core/infrastructure/routerHistory';
...
routerHistory.push("/");
...
I'm having the same issue. Can you provide your package.json? Might be some incompatibility with react-router-dom or redux. I'll let you updated if I find anything.
Same issue here. We have upgraded history to v5 but kept react-router to version v5 (and not upgraded to v6), perhaps is this the reason ?
Same issue here. We have upgraded history to v5 but kept react-router to version v5 (and not upgraded to v6), perhaps is this the reason ?
Indeed, it works with RR6