MCPcopy Create free account
hub / github.com/streamich/react-use / composeMiddleware

Function composeMiddleware

src/factory/createReducer.ts:15–21  ·  view source on GitHub ↗
(chain: Middleware<Action, State>[])

Source from the content-addressed store, hash-verified

13) => (next: Dispatch<Action>) => (action: Action) => void;
14
15function composeMiddleware<Action, State>(chain: Middleware<Action, State>[]) {
16 return (context: Store<Action, State>, dispatch: Dispatch<Action>) => {
17 return chain.reduceRight((res, middleware) => {
18 return middleware(context)(res);
19 }, dispatch);
20 };
21}
22
23const createReducer = <Action, State>(...middlewares: Middleware<Action, State>[]) => {
24 const composedMiddleware = composeMiddleware<Action, State>(middlewares);

Callers 1

createReducerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…