as-redux-util
Redux util to help simplify redux usage. Inspired by dva.
usage
; const calcManager = namespace: 'calc' state: sum: 0 reducers: ...state ...payload || {} ; const createAction = ReduxUtil; const calcActions = { const addNum = payload; return { const calc: sum = ; ; }; }; ;
; const LIGHT_STYLES = backgroundColor: '#f7f7f7' textColor: '#333' buttonBgColor: 'black' buttonTextColor: 'white'; const DARK_STYLES = backgroundColor: '#282c34' textColor: 'white' buttonBgColor: 'white' buttonTextColor: 'black'; const THEMES = light: LIGHT_STYLES dark: DARK_STYLES; const themeManager = namespace: 'theme' state: theme: THEMESdark reducers: ...state ...payload || {} ; const createAction = ReduxUtil; const themeActions = { return { ; }; }; ;
;;;; // convenience create reducersReduxUtil;// or you can do like// export default combineReducers({// theme: ReduxUtil.generateReducer(theme),// calc: ReduxUtil.generateReducer(calc),// });