React · Senior · Question 33 of 75
What is the signature of a Redux middleware?
- ✓Correct answer:
store => next => action => { ... } - 2
(state, action) => newState | void - 3
action => store => dispatch(action)
Explanation
Currying gives the middleware access to getState/dispatch, the next link in the chain next, and the current action. A middleware can log, modify, delay or replace actions (e.g. thunk calls functions instead of passing them on). (state, action) => newState is a reducer.