Skip to content

Instantly share code, notes, and snippets.

@cjoecker
Created March 28, 2020 19:13
Show Gist options
  • Save cjoecker/5614d4fb2d5b1f58d37bb3f6c3bc5d9b to your computer and use it in GitHub Desktop.
Save cjoecker/5614d4fb2d5b1f58d37bb3f6c3bc5d9b to your computer and use it in GitHub Desktop.
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