react router 的push replace

Posted huxiaoyun90

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了react router 的push replace相关的知识,希望对你有一定的参考价值。

摘要

我们在做一些query 操作的时候,经常会需要同步至url, 在这里我们可以使用 react-router-redux 实现即可


import { push } from 'react-router-redux';


this.dispath(push({
  path: 'xx',
  search: 'xx',
}));

两者的区别

push 是往 history 里面增加一层堆栈,
history 是直接替换当前url

以上是关于react router 的push replace的主要内容,如果未能解决你的问题,请参考以下文章