Last active
March 13, 2019 23:48
-
-
Save webmasterdevlin/6b85b84aad8d83f4d3cc21db8bb56548 to your computer and use it in GitHub Desktop.
Redux Store : src/store/index.js
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 { combineReducers, createStore, applyMiddleware } from "redux"; | |
import { heroReducer } from "./hero/hero-reducer"; | |
import { villainReducer } from "./villain/villain-reducer"; | |
import thunk from "redux-thunk"; // 3rd-party side-effects library. | |
import { composeWithDevTools } from "redux-devtools-extension"; // Redux devtools for time travel debugging. | |
/* | |
Merge all your reducers here. Name it rootReducer. | |
*/ | |
const rootReducer = combineReducers({ | |
heroState: heroReducer, | |
villainState: villainReducer | |
}); | |
/* | |
This is the store. In Redux, there's only one store. Also known as single source of thruth. | |
*/ | |
export const store = createStore( | |
rootReducer, // Put your rootReducer here | |
composeWithDevTools(applyMiddleware(thunk)) // Making thunk as middleware | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment