Last active
September 4, 2017 18:29
-
-
Save arackaf/83a8618cb16c1560993c1bcb89625e3a to your computer and use it in GitHub Desktop.
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
| const combineLazyReducers = (reducers, initialState) => { | |
| let reducerKeys = new Set(Object.keys(reducers)); | |
| Object.keys(initialState) | |
| .filter(k => !reducerKeys.has(k)) | |
| .forEach(k => { | |
| reducers[k] = state => state === undefined ? null : state | |
| }); | |
| return combineReducers(reducers); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment