function createReducer(initialState, handlers) {
return function reducer(state = initialState, action) {
if (handlers.hasOwnProperty(action.type)) {
return handlers[action.type](state, action)
} else {
return state
}
}
} const todosreducer = createReducer([], {
'ADD_TODO': addTodo,
'TOGGLE_TODO': toggleTodo,
'EDIT_TODO': editTodo
});
相关文章
- 08-03Taro+react开发(40)封装组件1
- 08-03使用echarts-for-react 绘制折线图 报错:`series.type should be specified `
- 08-03003 React遍历列表
- 08-03React 实现进度环组件
- 08-03react 图片懒加载
- 08-03关于vue和react中axios请求的拦截和响应拦截
- 08-03react: typescript import images alias
- 08-03怎么让 arcgis 4 弹出窗 漂亮 支持多个弹出窗 支持vue或者react
- 08-03react里 MD5加密
- 08-03React_day04_react路由、组件间通信、新闻网站构建