MCPcopy
hub / github.com/reduxjs/redux / loggerMiddleware

Function loggerMiddleware

test/typescript/middleware.ts:17–30  ·  view source on GitHub ↗
({ getState })

Source from the content-addressed store, hash-verified

15function 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}

Callers

nothing calls this directly

Calls 2

getStateFunction · 0.85
nextFunction · 0.70

Tested by

no test coverage detected