mocheng / react-and-redux

《深入浅出React和Redux》代码

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

187页最上边理解有误

BetterZxx opened this issue · comments

compose生成的函数参数的执行顺序应该是从右到左,文中说applyMiddelware放在第一个位置是为了优先处理action,应该是为了最后处理action,可以参考redux源码
compose源码注释:

  • from right to left. For example, compose(f, g, h) is identical to doing
  • (...args) => f(g(h(...args))).
    applyMiddleware源码注释:
  • Because middleware is potentially asynchronous, this should be the first
  • store enhancer in the composition chain.