Open R10burning opened 4 years ago
EDIT: got it removing
me the same!!
EDIT: got it removing in the Routes.
me the same!!
"got it removing in the Routes" sorry i didn't understand,have you solved it?
EDIT: got it removing in the Routes. me the same!!
"got it removing in the Routes" sorry i didn't understand,have you solved it?
I had an external "routes component", with another
同样的问题
For anyone who happens to land here, @velcis is saying
<Provider store={store}>
<ConnectedRouter history={history}>
<Router>
<App />
</Router>
</ConnectedRouter>
</Provider>
should be
<Provider store={store}>
<ConnectedRouter history={history}>
<App />
</ConnectedRouter>
</Provider>
which was hella hard to track down. Not sure if the nested Router
is entirely unintended or vestigial of an older version's intended setup, but killing it fixes the issue of URL changing on <Link to="/path" />
or useHistory().push("/path")
but the app not registering or rendering any changes
import React, { Component } from 'react' import { connect } from 'react-redux' import { test } from '@/actions/common' import store from '@/store' import { push } from 'connected-react-router' import PropTypes from 'prop-types' @connect((state) => ({ home: state.home }), { test }) class Home extends Component { static propTypes = { test: PropTypes.func.isRequired } componentDidMount() {} toUrl = (e) => { e.stopPropagation() store.dispatch(push('/about')) } render() { return ( <div onClick={() => this.props.test()}>
} }
export default Home
dependencies : "connected-react-router": "^6.8.0", "core-js": "2", "history": "^4.10.1", "react": "^16.13.1", "react-dom": "^16.13.1", "react-redux": "^7.2.0", "react-router-dom": "^5.1.2", "react-router-redux": "^4.0.8", "redux": "^4.0.5", "redux-actions": "^2.6.5", "redux-logger": "^3.0.6", "redux-saga": "^1.1.3"