1
路由不起作用。每條路線總是呈現組件的MainPage在react-redux應用程序中路由不起作用
index.js
import React from 'react'
import { render } from 'react-dom'
import { Provider } from 'react-redux'
import { createStore } from 'redux'
import reducers from './reducers'
import App from './components/App'
let store = createStore(reducers);
render(
<Provider store={store}>
<App />
</Provider>,
document.querySelector('#root')
);
組件應用與所描述的路線
import React from 'react'
import { browserHistory, Router, Route } from 'react-router'
import MainPage from '../containers/MainPage';
import FavoritesPage from '../containers/FavoritesPage';
import Error404 from '../containers/Error404';
export default() => (
<Router history={browserHistory}>
<Route path="/" component={MainPage}>
<Route path="/favorites" component={FavoritesPage}/>
<Route path="*" component={Error404}/>
</Route>
</Router>
);
你在這裏看到的任何問題?
這個例子是驚人的幫助!非常感謝! – JILeXanDR