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/configureStore.mdx
+11-9Lines changed: 11 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -154,14 +154,15 @@ An optional initial state value to be passed to the Redux `createStore` function
154
154
155
155
### `enhancers`
156
156
157
-
An optional array of Redux store enhancers, or a callback function to customize the array of enhancers.
157
+
A callback function to customize the array of enhancers.
158
158
159
-
If defined as an array, these will be passed to [the Redux `compose` function](https://redux.js.org/api/compose), and the combined enhancer will be passed to `createStore`.
159
+
Enhancers returned by this callback will be passed to [the Redux `compose` function](https://redux.js.org/api/compose), and the combined enhancer will be passed to `createStore`.
@@ -174,7 +175,7 @@ For more details on how the `enhancer` parameter works and the list of enhancers
174
175
175
176
:::caution Middleware
176
177
177
-
If you provide an array, this`applyMiddleware` enhancer will _not_ be used.
178
+
If you don't use `getDefaultEnhancers` and instead return an array, the`applyMiddleware` enhancer will _not_ be used.
178
179
179
180
`configureStore` will warn in console if any middleware are provided (or left as default) but not included in the final list of enhancers.
180
181
@@ -196,23 +197,24 @@ configureStore({
196
197
configureStore({
197
198
reducer,
198
199
middleware: () => [],
199
-
enhancers: () => [offline(offlineConfig)],
200
+
enhancers: () => [offline(offlineConfig)],
200
201
})
201
202
```
202
203
204
+
Note that if using Typescript, the `middleware` option is required to be provided _before_ the enhancer option, as the type of `getDefaultEnhancers` depends on its result.
205
+
203
206
:::
204
207
205
208
:::note Tuple
206
209
Typescript users are required to use a `Tuple` instance (ifnotusinga`getDefaultEnhancer`result, whichisalreadya`Tuple`), for better inference.
0 commit comments