# Function applyMiddleware

- applyMiddleware(): StoreEnhancer

- Creates a store enhancer that applies middleware to the dispatch method of the Redux store. This is handy for a variety of tasks, such as expressing asynchronous actions in a concise manner, or logging every action payload.

  See `redux-thunk` package as an example of the Redux middleware.

  Because middleware is potentially asynchronous, this should be the first store enhancer in the composition chain.

  Note that each middleware will be given the `dispatch` and `getState` functions as named arguments.

  #### Returns StoreEnhancer

  A store enhancer applying the middleware.

  - Defined in common/temp/node_modules/.pnpm/redux@4.2.1/node_modules/redux/index.d.ts:587
- applyMiddleware<Ext1, S>(middleware1): StoreEnhancer<{
  dispatch: Ext1;
  }>

- #### Type Parameters

  - Ext1
  - S

  #### Parameters

  - middleware1: Middleware<Ext1, S, any>

  #### Returns StoreEnhancer<{
  dispatch: Ext1;
  }>

  - Defined in common/temp/node_modules/.pnpm/redux@4.2.1/node_modules/redux/index.d.ts:588
- applyMiddleware<Ext1, Ext2, S>(middleware1, middleware2): StoreEnhancer<{
  dispatch: Ext1 & Ext2;
  }>

- #### Type Parameters

  - Ext1
  - Ext2
  - S

  #### Parameters

  - middleware1: Middleware<Ext1, S, any>
  - middleware2: Middleware<Ext2, S, any>

  #### Returns StoreEnhancer<{
  dispatch: Ext1 & Ext2;
  }>

  - Defined in common/temp/node_modules/.pnpm/redux@4.2.1/node_modules/redux/index.d.ts:591
- applyMiddleware<Ext1, Ext2, Ext3, S>(middleware1, middleware2, middleware3): StoreEnhancer<{
  dispatch: Ext1 & Ext2 & Ext3;
  }>

- #### Type Parameters

  - Ext1
  - Ext2
  - Ext3
  - S

  #### Parameters

  - middleware1: Middleware<Ext1, S, any>
  - middleware2: Middleware<Ext2, S, any>
  - middleware3: Middleware<Ext3, S, any>

  #### Returns StoreEnhancer<{
  dispatch: Ext1 & Ext2 & Ext3;
  }>

  - Defined in common/temp/node_modules/.pnpm/redux@4.2.1/node_modules/redux/index.d.ts:595
- applyMiddleware<Ext1, Ext2, Ext3, Ext4, S>(middleware1, middleware2, middleware3, middleware4): StoreEnhancer<{
  dispatch: Ext1 & Ext2 & Ext3 & Ext4;
  }>

- #### Type Parameters

  - Ext1
  - Ext2
  - Ext3
  - Ext4
  - S

  #### Parameters

  - middleware1: Middleware<Ext1, S, any>
  - middleware2: Middleware<Ext2, S, any>
  - middleware3: Middleware<Ext3, S, any>
  - middleware4: Middleware<Ext4, S, any>

  #### Returns StoreEnhancer<{
  dispatch: Ext1 & Ext2 & Ext3 & Ext4;
  }>

  - Defined in common/temp/node_modules/.pnpm/redux@4.2.1/node_modules/redux/index.d.ts:600
- applyMiddleware<Ext1, Ext2, Ext3, Ext4, Ext5, S>(middleware1, middleware2, middleware3, middleware4, middleware5): StoreEnhancer<{
  dispatch: Ext1 & Ext2 & Ext3 & Ext4 & Ext5;
  }>

- #### Type Parameters

  - Ext1
  - Ext2
  - Ext3
  - Ext4
  - Ext5
  - S

  #### Parameters

  - middleware1: Middleware<Ext1, S, any>
  - middleware2: Middleware<Ext2, S, any>
  - middleware3: Middleware<Ext3, S, any>
  - middleware4: Middleware<Ext4, S, any>
  - middleware5: Middleware<Ext5, S, any>

  #### Returns StoreEnhancer<{
  dispatch: Ext1 & Ext2 & Ext3 & Ext4 & Ext5;
  }>

  - Defined in common/temp/node_modules/.pnpm/redux@4.2.1/node_modules/redux/index.d.ts:606
- applyMiddleware<Ext, S>(...middlewares): StoreEnhancer<{
  dispatch: Ext;
  }>

- #### Type Parameters

  - Ext
  - S = any

  #### Parameters

  - `Rest` ...middlewares: Middleware<any, S, any>[]

  #### Returns StoreEnhancer<{
  dispatch: Ext;
  }>

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