使用react-router-redux重新加载页面的正确方法是什么?
我们通常以这种方式在操作中推送一个新状态,
export function doTask() {
return dispatch => {
dispatch(DoTask.request());
fetch(`${API}/doTask`, get())
.then(status)
.then(_ => dispatch(doTask.success()))
.then(_ => dispatch(push('/dashboard')))
.catch(error => dispatch(DoTask.failure(error))) }}
我想知道以这种方式触发页面重新加载是否是一个好习惯,
.then(_ => window.location.reload())
有更好的选择吗?
最佳答案
您可以使用window.location.reload()
关于reactjs - 在react-redux中重新加载页面的正确方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45542332/