我正在使用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;