首页 > 其他 > 详细

[Redux] Reducer Composition with combineReducers()

时间:2015-12-22 06:27:10      阅读:254      评论:0      收藏:0      [点我收藏+]

Previous, we do composition with objects:

const todoApp = (state = {}, action) => {
  return {
    todos: todos(
      state.todos,
      action
    ),
    visibilityFilter: visibilityFilter(
      state.visibilityFilter,
      action
    )
  };
};

 

Since it is common options in Redux,  there is a function call ‘combineReducers‘:

const {combineReducers} = Redux;
combineReducers({
   todos,   //ES6 shortcut syntax
   visibilityFilter
});

 

[Redux] Reducer Composition with combineReducers()

原文:http://www.cnblogs.com/Answer1215/p/5065436.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!