({ getState })
| 15 | function logger() { |
| 16 | const loggerMiddleware: Middleware = |
| 17 | ({ getState }) => |
| 18 | next => |
| 19 | action => { |
| 20 | console.log('will dispatch', action) |
| 21 | |
| 22 | // Call the next dispatch method in the middleware chain. |
| 23 | const returnValue = next(action) |
| 24 | |
| 25 | console.log('state after dispatch', getState()) |
| 26 | |
| 27 | // This will likely be the action itself, unless |
| 28 | // a middleware further in chain changed it. |
| 29 | return returnValue |
| 30 | } |
| 31 | |
| 32 | return loggerMiddleware |
| 33 | } |