@@ -109,7 +109,7 @@ Note that this only works for one level of reducers. If you want to nest reducer
109
109
If you need to customize the store setup, you can pass additional options. Here's what the hot reloading example might look like using Redux Toolkit:
110
110
111
111
``` js
112
- import { configureStore , getDefaultMiddleware } from ' @reduxjs/toolkit'
112
+ import { configureStore } from ' @reduxjs/toolkit'
113
113
114
114
import monitorReducersEnhancer from ' ./enhancers/monitorReducers'
115
115
import loggerMiddleware from ' ./middleware/logger'
@@ -118,7 +118,8 @@ import rootReducer from './reducers'
118
118
export default function configureAppStore (preloadedState ) {
119
119
const store = configureStore ({
120
120
reducer: rootReducer,
121
- middleware: [loggerMiddleware, ... getDefaultMiddleware ()],
121
+ middleware : getDefaultMiddleware =>
122
+ getDefaultMiddleware ().concat (loggerMiddleware),
122
123
preloadedState,
123
124
enhancers: [monitorReducersEnhancer]
124
125
})
@@ -1106,41 +1107,36 @@ RRF includes timestamp values in most actions and state as of 3.x, but there are
1106
1107
A possible configuration to work with that behavior could look like:
1107
1108
1108
1109
``` ts
1109
- import { configureStore , getDefaultMiddleware } from ' @reduxjs/toolkit'
1110
+ import { configureStore } from ' @reduxjs/toolkit'
1110
1111
import {
1111
1112
getFirebase ,
1112
1113
actionTypes as rrfActionTypes
1113
1114
} from ' react-redux-firebase'
1114
1115
import { constants as rfConstants } from ' redux-firestore'
1115
1116
import rootReducer from ' ./rootReducer'
1116
1117
1117
- const extraArgument = {
1118
- getFirebase
1119
- }
1120
-
1121
- const middleware = [
1122
- ... getDefaultMiddleware ({
1123
- serializableCheck: {
1124
- ignoredActions: [
1125
- // just ignore every redux-firebase and react-redux-firebase action type
1126
- ... Object .keys (rfConstants .actionTypes ).map (
1127
- type => ` ${rfConstants .actionsPrefix }/${type } `
1128
- ),
1129
- ... Object .keys (rrfActionTypes ).map (
1130
- type => ` @@reactReduxFirebase/${type } `
1131
- )
1132
- ],
1133
- ignoredPaths: [' firebase' , ' firestore' ]
1134
- },
1135
- thunk: {
1136
- extraArgument
1137
- }
1138
- })
1139
- ]
1140
-
1141
1118
const store = configureStore ({
1142
1119
reducer: rootReducer ,
1143
- middleware
1120
+ middleware : getDefaultMiddleware =>
1121
+ getDefaultMiddleware ({
1122
+ serializableCheck: {
1123
+ ignoredActions: [
1124
+ // just ignore every redux-firebase and react-redux-firebase action type
1125
+ ... Object .keys (rfConstants .actionTypes ).map (
1126
+ type => ` ${rfConstants .actionsPrefix }/${type } `
1127
+ ),
1128
+ ... Object .keys (rrfActionTypes ).map (
1129
+ type => ` @@reactReduxFirebase/${type } `
1130
+ )
1131
+ ],
1132
+ ignoredPaths: [' firebase' , ' firestore' ]
1133
+ },
1134
+ thunk: {
1135
+ extraArgument: {
1136
+ getFirebase
1137
+ }
1138
+ }
1139
+ })
1144
1140
})
1145
1141
1146
1142
export default store
0 commit comments