# Interface Middleware<DispatchExt, S, D>

A middleware is a higher-order function that composes a dispatch function to return a new dispatch function. It often turns async actions into actions.

Middleware is composable using function composition. It is useful for logging actions, performing side effects like routing, or turning an asynchronous API call into a series of synchronous actions.

interface Middleware<DispatchExt, S, D> ((api) => ((next) => ((action) => any)))

#### Type Parameters

- DispatchExt = {}

  Extra Dispatch signature added by this middleware.

- S = any

  The type of the state supported by this middleware.

- D extends Dispatch = Dispatch

  The type of Dispatch of the store where this middleware is installed.

- Middleware(api): ((next) => ((action) => any))

- #### Parameters

  - api: MiddlewareAPI<D, S>

  #### Returns ((next) => ((action) => any))

  - - (next): ((action) => any)

    - #### Parameters

      - next: Dispatch<AnyAction>

      #### Returns ((action) => any)

      - - (action): any

        - #### Parameters

          - action: any

          #### Returns any

  - Defined in common/temp/node_modules/.pnpm/redux@4.2.1/node_modules/redux/index.d.ts:562