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
// Compose all your Stores into a single Store function with `composeStores`:
262
263
conststore=composeStores(stores);
263
264
264
265
// Create a Dispatcher function for your composite Store:
265
-
constdispatcher=createDispatcher(store);
266
+
constdispatcher=createDispatcher(
267
+
store,
268
+
getState=> [thunkMiddleware(getState)] // Pass the default middleware
269
+
);
266
270
267
271
// Create a Redux instance using the dispatcher function:
268
272
constredux=createRedux(dispatcher);
269
273
```
270
274
271
275
Why would you want to write it longer? Maybe you're an advanced user and want to provide a custom Dispatcher function, or maybe you have a different idea of how to compose your Stores (or you're satisfied with a single Store). Redux lets you do all of this.
272
276
277
+
`createDispatcher()` also gives you the ability to specify middleware -- for example, to add support for promises. [Learn more](https://github.com/gaearon/redux/blob/master/docs/middleware.md) about how to create and use middleware in Redux.
0 commit comments