push() 调度 LOCATION_CHANGE 动作,即使我推送相同的 url

push() dispatches LOCATION_CHANGE action even if I push the same url

我正在使用内置的 react-router-redux push() action-creator 在我的应用程序中导航路线。即使我按与前一个相同的 URL,它也会调度 LOCATION_CHANGE 操作。

这是默认行为吗?如果是,我可以在不编写额外中间件的情况下以某种方式更改它吗?

当您 dispatch 来自 action-creater 的一个动作时,您通常期望一个动作被调度。所以是的,这是默认行为。

你可以看看操作实现here

您可以在发送操作之前检查您的位置:

import { history } from './app.js'; // file where you export history instance

const location = history.getCurrentLocation();