当导航到任何路线时,React-router-redux显示空屏幕

时间:2017-03-27 11:51:41

标签: redux react-router react-redux react-router-redux

我正在使用react-router 3.x react-router-redux。下面是我的代码 当我导航到/hello时,我只能看到一个空屏幕。可以请任何人帮我弄清楚我做错了什么。

import React from 'react'
import ReactDOM from 'react-dom'
import { createStore, combineReducers, applyMiddleware } from 'redux'
import { Provider } from 'react-redux'
import { Router, Route, browserHistory } from 'react-router'
import { syncHistoryWithStore, routerReducer, routerMiddleware } from 'react-router-redux'
import EngagementsContainer from './Engagements/EngagementsContainer.js'
import EngagementViewContainer from './Engagements/EngagementViewContainer.js'
import EngagementReducer from './Engagements/reducers/reducers.js'
import thunk from 'redux-thunk'

// Add the reducer to your store on the `routing` key
const store = createStore(
  combineReducers({
  routing: routerReducer,
  deals: EngagementReducer
}),
applyMiddleware(thunk),
);

store.subscribe( state => console.log(state) );

// Create an enhanced history that syncs navigation events with the store
const history = syncHistoryWithStore(browserHistory, store)

 const AppRoutes = () => { return (
    <Provider store={store} >
     <Router history={ browserHistory } >
       <Route path="/" component={ EngagementsContainer } >
       <Route path="hello" component={ EngagementViewContainer } />
    </Route>
  </Router>
</Provider>
) };

export default AppRoutes;

0 个答案:

没有答案