Created
April 6, 2016 02:37
-
-
Save aviraldg/5c9341039c9b3d46f7d0cdd3a0ba0f80 to your computer and use it in GitHub Desktop.
This file contains 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
/* Combine all available reducers to a single root reducer. | |
* | |
* CAUTION: When using the generators, this file is modified in some places. | |
* This is done via AST traversal - Some of your formatting may be lost | |
* in the process - no functionality should be broken though. | |
* This modifications only run once when the generator is invoked - if | |
* you edit them, they are not updated again. | |
*/ | |
import { combineReducers } from 'redux'; | |
/* Populated by react-webpack-redux:reducer */ | |
const reducers = { navigation: require('./navigation') }; | |
export default combineReducers(reducers); |
This file contains 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
'use strict'; | |
const redux = require('redux'); | |
import reducers from '../reducers'; | |
import thunkMiddleware from 'redux-thunk'; | |
import loggerMiddleware from 'redux-logger'; | |
export default function configureStore(initialState) { | |
const store = redux.createStore(reducers, | |
initialState, | |
redux.applyMiddleware(thunkMiddleware, loggerMiddleware) | |
); | |
if (module.hot) { | |
// Enable Webpack hot module replacement for reducers | |
module.hot.accept('../reducers', () => { | |
const nextReducer = require('../reducers'); | |
store.replaceReducer(nextReducer) | |
}) | |
} | |
return store | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment