2016-07-05 29 views
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是历史模块,由反应路由器使用: Developer Tools panel in Chrome

我很感激任何输入或建议。很高兴提供更多的细节。

干杯!

+0

in useQueries.js,你如何实例化历史? –

+0

嗨,这不是我的JS,它是已安装软件包的一部分。你可以看到我如何在我提供的代码片段中实例化它 - 使用react-router-redux中的syncHistoryWithStore。谢谢! – justabuzz

+0

如果这是一个包内,它可能与你创建的实例无关 –

回答

0

好的,我在一段时间后返回了这段代码,发现生产配置文件中有一个错字。所以 - 一切都好! :)