Skip to content

Commit c9e826f

Browse files
authored
Merge pull request #2197 from EskiMojo14/docs-batch-correction
2 parents 431dd6c + 3d802a4 commit c9e826f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

docs/api/configureStore.mdx

+6-4
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ import { configureStore } from '@reduxjs/toolkit'
169169
// We'll use redux-logger just as an example of adding another middleware
170170
import logger from 'redux-logger'
171171
172-
// And use redux-batch as an example of adding enhancers
173-
import { reduxBatch } from '@manaflair/redux-batch'
172+
// And use redux-batched-subscribe as an example of adding enhancers
173+
import { batchedSubscribe } from 'redux-batched-subscribe'
174174
175175
import todosReducer from './todos/todosReducer'
176176
import visibilityReducer from './visibility/visibilityReducer'
@@ -194,17 +194,19 @@ const preloadedState = {
194194
visibilityFilter: 'SHOW_COMPLETED',
195195
}
196196
197+
const debounceNotify = _.debounce(notify => notify());
198+
197199
const store = configureStore({
198200
reducer,
199201
middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(logger),
200202
devTools: process.env.NODE_ENV !== 'production',
201203
preloadedState,
202-
enhancers: [reduxBatch],
204+
enhancers: [batchedSubscribe(debounceNotify)],
203205
})
204206
205207
// The store has been created with these options:
206208
// - The slice reducers were automatically passed to combineReducers()
207209
// - redux-thunk and redux-logger were added as middleware
208210
// - The Redux DevTools Extension is disabled for production
209-
// - The middleware, batch, and devtools enhancers were composed together
211+
// - The middleware, batched subscribe, and devtools enhancers were composed together
210212
```

0 commit comments

Comments
 (0)