How do you create strongly typed redux middleware in TypeScript from Redux’s type definitions?

MyStore is not required.

export const Logger: Middleware =
  (api: MiddlewareAPI<void>) => 
  (next: Dispatch<void>) => 
  <A extends Action>(action: A) => {
    // Do stuff
   return next(action);
  };

or

export const Logger: Middleware = api => next => action => {
  // Do stuff
  return next(action);
};

Have a Nice Dev

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)