history
history copied to clipboard
history.push() stopped working after upgrading to v5
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
Same issue: Uncaught Could not find router reducer in state tree, it must be mounted under "router"
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 [email protected]
Looks like a duplicate of #803
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
.
Downgrading to [email protected]
fixed the problem.
Duplicate of #804 and #803
same thing, we are using hash router and history.push()
is no longer working
Have you guys check the migration list?
https://github.com/ReactTraining/react-router/blob/dev/docs/advanced-guides/migrating-5-to-6.md
@brendonco I think this issue is regarding upgrading to v5, not v6