Appearing unconventional is no issue.
const logger = store => next => action => {
console.log('dispatching', action)
let result = next(action)
console.log('next state', store.getState())
return result
}
It's worth noting that functional languages typically follow this format as a standard practice, so it shouldn't seem strange.
The rationale behind this approach is to avoid relying on monkey patching as a common programming technique. Passing the next
parameter to the function offers more flexibility and places less constraints on the function being called (which belongs to the developer), ultimately reducing the likelihood of errors.
Ultimately, while Dan may like to provide explanations for his coding choices, as users of the library, we developers do not have decision-making authority. The decision has already been made regarding how middleware should be utilized in Redux. While you have the option to fork Redux and make modifications, it's important to recognize that the true power of Redux lies in the additional code created by third-party developers. By diverging from the established conventions, you would miss out on leveraging that collective expertise.