【发布时间】:2018-04-12 12:59:06
【问题描述】:
尝试使用 redux、immutable 和 react-redux-router 创建应用程序。
所用软件包的版本:
"immutable": "^3.8.2",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-redux": "^5.0.6",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
"react-router-redux": "^4.0.8",
"history": "^4.7.2",
"redux": "^3.7.2",
"redux-immutable": "^4.0.0"
我正在使用来自 history npm 包的 createSagaMiddleware 函数创建历史记录。
import createHistory from 'history/createBrowserHistory';
const browserHistory: any = createHistory();
但是,如果我将这个历史实例传递给 syncHistoryWithStore 函数以从商店同步我的位置和状态
const history = syncHistoryWithStore(browserHistory, store, {
selectLocationState: createSelectLocationState()
});
当我尝试导航到某个页面时出现以下错误:
因为我的历史对象没有transitionTo 函数。
我在哪里可以得到适合这个任务的历史对象?
感谢您的帮助!
【问题讨论】:
标签: reactjs redux react-redux react-router-v4 react-router-redux