【发布时间】:2016-04-15 15:54:18
【问题描述】:
我正在尝试将 react-router 2.0 与 redux-simple-router 一起使用,但我无法让它与查询解析一起使用。这是我从文档中得到的:
const appHistory = useRouterHistory({
parseQueryString: parse,
stringifyQueryString: stringify
})
但是,如果我像这样将历史记录传递给 redux-simple-router ...
syncReduxAndRouter(appHistory, store, (state) => state.router)
...我得到history.listen is not a function。直接使用 react-router 中的 browserHistory 似乎与 redux-simple-router 一起工作得很好。为什么listen() 从历史记录中丢失,我该如何解决这个问题?
【问题讨论】:
-
如果您使用自定义历史记录,请确保使用 redux-simple-router 2.x
npm install redux-simple-router@next和 history 2.0。我需要basename选项并通过安装这两个选项使其工作。
标签: reactjs react-router react-router-redux