Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blank page when pushing to hash history after upgrading from v4 to v5 #922

Open
joao-mambelli opened this issue Dec 23, 2021 · 3 comments
Open

Comments

@joao-mambelli
Copy link

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("/");
...
@edilsonborges
Copy link

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.

@abenhamdine
Copy link

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 ?

@abenhamdine
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants