bigbuffet-rw/app/soapbox/store.ts

25 lines
722 B
TypeScript
Raw Normal View History

2022-04-25 10:43:13 -07:00
import { configureStore } from '@reduxjs/toolkit';
import { AnyAction } from 'redux';
2022-03-18 14:04:08 -07:00
import thunk, { ThunkDispatch } from 'redux-thunk';
import errorsMiddleware from './middleware/errors';
import soundsMiddleware from './middleware/sounds';
import appReducer from './reducers';
2022-04-25 10:43:13 -07:00
export const store = configureStore({
reducer: appReducer,
middleware: [
thunk,
errorsMiddleware(),
soundsMiddleware(),
],
devTools: true,
});
2022-04-24 12:28:07 -07:00
export type Store = typeof store;
// Infer the `RootState` and `AppDispatch` types from the store itself
// https://redux.js.org/usage/usage-with-typescript
export type RootState = ReturnType<typeof store.getState>;
2022-03-18 14:04:08 -07:00
export type AppDispatch = ThunkDispatch<{}, {}, AnyAction>;