【问题标题】:What is the proper way to do a page reload in react-redux?在 react-redux 中重新加载页面的正确方法是什么?
【发布时间】:2018-01-14 11:45:01
【问题描述】:

使用 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())

有更好的选择吗?

【问题讨论】:

标签: reactjs react-redux react-router-redux


【解决方案1】:

您可以使用window.location.reload()

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-02
    • 2012-10-03
    • 1970-01-01
    • 1970-01-01
    • 2017-01-14
    相关资源
    最近更新 更多