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 | import { combineReducers } from 'redux'; const defaults = { TOPIC: 'javascript', DISPLAY_MODE: 'THUMBNAIL', } const topicReducer = (state = defaults.TOPIC, action) => { switch(action.type) { case 'SET_TOPIC': return action.topic; default: return state; } } const displayModeReducer = (state = defaults.DISPLAY_MODE, action) => { switch(action.type) { case 'SET_DISPLAY_MODE': return action.displayMode; default: return state; } } // Combine reducers export default combineReducers({ topic: topicReducer, displayMode: displayModeReducer }); |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |