1
我正在开发一个React应用程序并使用react-router。当我使用开发服务器在本地运行应用程序时,所有的都很好,但是当我将它捆绑后,当访问页面时,我得到了“history.listen不是函数”。react-router-history.listen不是函数
这里是我已安装包版本:
[email protected]
[email protected]
[email protected]
[email protected]
这是我如何接线路由器:
import React from 'react';
import ReactDOM from 'react-dom';
import { browserHistory } from 'react-router'
import { syncHistoryWithStore } from 'react-router-redux'
import { configureStore } from './store/configureStore';
import { Root } from './containers/Root';
const store = configureStore();
const history = syncHistoryWithStore(browserHistory, store)
ReactDOM.render(
<Root store={store} history={history} />,
document.getElementById('root')
);
这里是我在JS控制台中看到的错误 - useQueries.js是历史模块,由反应路由器使用:
我很感激任何输入或建议。很高兴提供更多的细节。
干杯!
in useQueries.js,你如何实例化历史? –
嗨,这不是我的JS,它是已安装软件包的一部分。你可以看到我如何在我提供的代码片段中实例化它 - 使用react-router-redux中的syncHistoryWithStore。谢谢! – justabuzz
如果这是一个包内,它可能与你创建的实例无关 –