[Functional Programming ADT] Combine Multiple State ADT Base
Redux provides a convenient helper for combining many reducers called? So we will put together our own helper that we also call? ? // combineReducers :: [ Reducer ] -> Reducer /* export const combineReducers = reducers => action => mreduceMap(First,applyTo(action),reducers); */ // We take reducers first and action second,but we use action first,reducers second. // It is good case to use flip /* export const combineReducers = flip(action => mreduceMap(First,applyTo(action)) );*/ // We can use compose to remove action param,applyTo will get action // Then the return result will be passed into mreduceMap(First) export const combineReducers = flip( compose( mreduceMap(First),applyTo ) ); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |