Created
February 11, 2019 19:44
-
-
Save aigoncharov/12cc44e6f09377a708b59ae1da6a537c to your computer and use it in GitHub Desktop.
Reducer organization - taking a step further
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createReducer } from 'redux-create-reducer' | |
const createClassReducer = (ReducerClass) => { | |
const reducerClass = new ReducerClass() | |
const methodsWithActionTypes = getReducerClassMethodsWthActionTypes( | |
reducerClass, | |
) | |
const reducerMap = getReducerMap(methodsWithActionTypes) | |
const initialState = reducerClass.initialState | |
const reducer = createReducer(initialState, reducerMap) | |
return reducer | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment