Created
March 28, 2020 19:13
-
-
Save cjoecker/5614d4fb2d5b1f58d37bb3f6c3bc5d9b to your computer and use it in GitHub Desktop.
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 {Action, applyMiddleware, combineReducers, compose, createStore,} from "redux"; | |
import thunk, {ThunkMiddleware} from "redux-thunk"; | |
import {Counter_Reducer, CounterState} from "./Counter_Reducer"; | |
import {FunFact_Reducer, FunFactState} from "./FunFact_Reducer"; | |
const rootReducer = combineReducers({ | |
Counter: Counter_Reducer, | |
FunFact: FunFact_Reducer | |
}); | |
interface rootState extends | |
CounterState, | |
FunFactState | |
{} | |
//This remains unchanged | |
export interface DispatchAction extends Action { | |
payload: Partial<rootState>; | |
} | |
const middleware = thunk as ThunkMiddleware<rootState, DispatchAction>; | |
const ReduxDevTools = | |
(window as any).__REDUX_DEVTOOLS_EXTENSION__ && | |
(window as any).__REDUX_DEVTOOLS_EXTENSION__(); | |
export default createStore( | |
rootReducer, | |
compose(applyMiddleware(middleware),ReduxDevTools) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment