【发布时间】:2020-05-08 03:35:55
【问题描述】:
this.props.history.replace({
state: {
from: 'dashboard'
}
});
this.props.history.goBack();
更新this.props.location.state后使用this.props.history.goBack()时this.props.location.state的值是undefined。但是
this.props.history.push({
pathname: '/',
state: {
from: 'dashboard'
}
});
有效并保留this.props.location.state 的值。
知道如何更新this.props.location.state 然后使用this.props.history.goBack?
【问题讨论】:
标签: reactjs react-router browser-history