
什么是reducer
reducer 就是?个纯函数,接收旧的 state 和 action,返回新的 state。
(previousState, action) => newState
之所以将这样的函数称之为 reducer,是因为这种函数与被传?
Array.prototype.reduce(reducer, ?initialValue) ?的回调函数属
于相同的类型。保持 reducer 纯净?常重要。永远不要在 reducer ?做这
些操作:
修改传?参数;
执?有副作?的操作,如 API 请求和路由跳转;
调??纯函数,如 Date.now() 或 Math.random()。
再次对redux进行研究
原文:https://www.cnblogs.com/zhouyideboke/p/13204526.html