1

我们在我们的应用中使用的是React + React-Redux + Redux-Saga,其中的withRouter一部分react-router-dom是在连接redux store的时候使用的。

export default withRouter(connect(mapStateToProps, mapDispatchToProps)(App));

问题步骤:

  1. 我在用户登陆页面上列出了所有用户。
  2. 我单击其中一个用户,然后使用withRouter,history.push函数进行重定向,该函数启动重定向this.props.history.push(${REDIRECT_URL});,这显示了当前单击的用户配置文件数据。
  3. 现在我回到用户登陆页面
  4. 我点击另一个用户,它再次启动,this.props.history.push(${REDIRECT_URL});之前访问过的用户数据在眨眼或几毫秒内显示,然后显示新点击的用户配置文件数据。

reduxForm为我的应用程序连接如下

export default withRouter(connect(mapStateToProps, mapDispatchToProps)(reduxForm({
    form: 'userProfile', // this form needs to be fixed I guess with passing other `(k,v)` to the `reduxForm`
    enableReinitialize: true,
})(UserInformation)));

有没有办法来解决这个问题?不显示以前访问过的用户数据?感谢帮助或指点。

4

0 回答 0