1 2 3 4 5 6 7 8 | // Combine reducers export default combineReducers({ books: fetchReducer, topic: topicReducer, currentStatus: statusReducer, displayMode: bookDisplayReducer }); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | import { combineReducers } from 'redux'; import { store } from './store'; import stateHistory from './statehistory'; ... const undo = reducer => (state = stateHistory.present, action) => { switch(action.type) { case 'UNDO': stateHistory.undo(); break; case 'REDO': stateHistory.redo(); break; case 'GOTO': stateHistory.gotoState(action.stateIndex); break; default: const newState = reducer(state, action); stateHistory.push(newState); } return stateHistory.present; } // Combine reducers export default undo(combineReducers({ books: fetchReducer, topic: topicReducer, currentStatus: statusReducer, displayMode: bookDisplayReducer })); |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |