-
-
Save sebastialonso/6ce6993050f9d9f63fc04a8159f6be37 to your computer and use it in GitHub Desktop.
Router_middleware
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Provider} from 'react-redux'; | |
import {createStore, applyMiddleware} from 'redux'; | |
import thunk from 'redux-thunk'; | |
import allReducers from './reducers/root_reducer'; | |
let createStoreWithMiddleware = applyMiddleware(thunk)(createStore); | |
const RouterComponent = (props) => { | |
const routes = ( | |
// blabla all routes | |
<Route path='/' component={BaseComponent}> | |
<IndexRedirect to="/data"/> | |
<Route path='data' component={DataComponents.index} onEnter={checkLogin}/> | |
</Route> | |
return ( | |
<Provider store={createStoreWithMiddleware(allReducers)}> | |
<Router history={hashHistory} routes={routes} /> | |
</Provider> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment