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

history.push() stopped working after upgrading to v5 #805

Open
saadbinsaeed opened this issue Jun 16, 2020 · 8 comments
Open

history.push() stopped working after upgrading to v5 #805

saadbinsaeed opened this issue Jun 16, 2020 · 8 comments

Comments

@saadbinsaeed
Copy link

saadbinsaeed commented Jun 16, 2020

I have recently upgraded history module from 4.10.1 to 5.0.0 and noticed that history.push() stopped working. After reverting it back to v4 it starts working.

Using hash history with react-router-redux

@etc-tiago
Copy link

Same issue: Uncaught Could not find router reducer in state tree, it must be mounted under "router"

@PulkitAgg
Copy link

I am facing the same issue. Its look like there is some issue in the newest version "5.0.0" of history package. For now we can change its version to "4.10.1" which works for me.
Use bellow command for chnage history version
npm install history@4.10.1

@mrlubos
Copy link

mrlubos commented Jun 17, 2020

Looks like a duplicate of #803

@nikdo
Copy link

nikdo commented Jun 18, 2020

Here is the minimal code to reproduce this issue in the browser:

import React from 'react'
import { Router, Switch, Route } from 'react-router-dom'
import { createBrowserHistory } from 'history'

const history = createBrowserHistory()

export default () => (
  <Router history={history}>
    <Switch>
      <Route path="/target">
        <h2>Target</h2>
      </Route>
      <Route path="/">
        <h2>Home</h2>
        <button onClick={() => history.push('/target')}>Push</button>
      </Route>
    </Switch>
  </Router>
)

URL is changed, but it seems that no route is matched after history.push.

  • react-router-dom@5.2.0
  • history@5.0.0

Downgrading to history@4.10.1 fixed the problem.

@saadbinsaeed saadbinsaeed changed the title history.push() stoppped working after upgrading to v5 history.push() stopped working after upgrading to v5 Jun 18, 2020
nikdo added a commit to nikdo/wind-alert that referenced this issue Jun 18, 2020
@avindra
Copy link

avindra commented Jun 19, 2020

Duplicate of #804 and #803

@danutzcodrescu
Copy link

same thing, we are using hash router and history.push() is no longer working

@brendonco
Copy link

Have you guys check the migration list?

https://github.com/ReactTraining/react-router/blob/dev/docs/advanced-guides/migrating-5-to-6.md

@mrlubos
Copy link

mrlubos commented Aug 14, 2020

@brendonco I think this issue is regarding upgrading to v5, not v6

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

8 participants