单击链接时,浏览器会尝试尽快重定向用户。如何在此过程中添加 1 秒延迟?
我有以下链接:
<Link
to={{
pathname: `pathname`,
hash: `#hash`,
}}
onClick={this.delayRedirect}
>
这是我的 delayRedirect 函数的样子:
delayRedirect() {
// not sure what to put here, to delay the redirect by 1 second
}
有任何想法吗?谢谢!