在超时时响应重定向页面 [英] react redirect page on timeOut

查看:53
本文介绍了在超时时响应重定向页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 setTimeOut 时使用 React 重定向页面.总体上仍然是开发新手,对 React 也很陌生,所以我有点迷茫.以下是我目前所拥有的...

I am trying to redirect a page using React upon a setTimeOut. Still new to developing in general and very new to React so I'm a bit lost. Below is what I have so far...

componentDidMount() {
        setTimeout(() => {
            ???????????('/')
        }, 1000)
    }

推荐答案

设法解决了.

componentWillMount(){
        setTimeout(() => { 
            this.props.history.push('/');
        }, 5000)
    }

这篇关于在超时时响应重定向页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆