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
`addMiddleware` appends the middleware instance to the chain of middlewares handled by the dynamic middleware instance. Middleware is applied in injection order, and stored by function reference (so the same middleware is only applied once regardless of how many times it's injected).
407
+
408
+
:::note
409
+
410
+
It's important to remember that all middlewares injected will be contained _within_ the original dynamic middleware instance.
// middleware chain is now [logger, thunk, logger]
452
+
```
453
+
454
+
:::
455
+
386
456
#### `withMiddleware`
387
457
458
+
`withMiddleware` is an action creator which, when dispatched, causes the middleware to add any middlewares included and returns a pre-typed version of `dispatch` with any added extensions.
Middleware is injected when `createDispatchWithMiddlewareHook` is called, _not_ when the `useDispatch` hook is called.
501
+
502
+
:::
503
+
504
+
##### `createDispatchWithMiddlewareHookFactory`
505
+
506
+
This method take a React context instance and creates an instance of `createDispatchWithMiddlewareHook` which uses that context. (see [Providing custom context](https://react-redux.js.org/using-react-redux/accessing-store#providing-custom-context))
0 commit comments