You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api/getDefaultEnhancers.mdx
+108Lines changed: 108 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -4,3 +4,111 @@ title: getDefaultEnhancers
4
4
sidebar_label: getDefaultEnhancers
5
5
hide_title: true
6
6
---
7
+
8
+
9
+
10
+
# `getDefaultEnhancers`
11
+
12
+
Returns an array containing the default list of enhancers.
13
+
14
+
## Intended Usage
15
+
16
+
By default, [`configureStore`](./configureStore.mdx) adds some enhancers to the Redux store setup automatically.
17
+
18
+
```js
19
+
conststore=configureStore({
20
+
reducer: rootReducer,
21
+
})
22
+
23
+
// Store has enhancers added, because the enhancer list was not customized
24
+
```
25
+
26
+
If you want to customise the list of enhancers, you can supply an array of enhancer functions to `configureStore`:
27
+
28
+
```js
29
+
conststore=configureStore({
30
+
reducer: rootReducer,
31
+
enhancers: [offline(offlineConfig)],
32
+
})
33
+
34
+
// store specifically has the offline enhancer applied
35
+
```
36
+
37
+
However, when you supply the `enhancer` option, you are responsible for defining _all_ the enhancers you want added
38
+
to the store (with the exception of the [devtools](./configureStore#devtools)). `configureStore` will not add any extra enhancers beyond what you listed, **including the middleware enhancer**.
39
+
40
+
`getDefaultEnhancers` is useful if you want to add some custom enhancers, but also still want to have the default
// Store has all of the default middleware + enhancers added, _plus_ the offline enhancer
57
+
```
58
+
59
+
## Included Default Enhancers
60
+
61
+
The resulting array will always contain the `applyMiddleware` enhancer created based on the `configureStore`'s `middleware` field.
62
+
63
+
Additionally, the [`autoBatchEnhancer`](./autoBatchEnhancer.mdx) is included, to allow for "batching" of low priority action updates. This is used by [RTK Query](/rtk-query/overview.mdx) and should improve performance when using it.
0 commit comments