Skip to content

@yantrix/redux v0.6.0 • Docs


Yantrix API / @yantrix/redux / createMiddleware

Function: createMiddleware() ​

ts
function createMiddleware<FSMAction, Snapshot>(
   FSM, 
   mapActionToFSMPayload, 
   mapContextToAction): Middleware

Creates a Redux middleware that owns one FSM instance per store. Unmapped Redux actions pass through. A matched action drives the machine, then the middleware forwards the original action followed by any mapped action. Dispatch returns the downstream result for the original action.

Type Parameters ​

• FSMAction

• Snapshot

Parameters ​

• FSM

• mapActionToFSMPayload

• mapContextToAction

Returns ​

Middleware