This repository has been archived by the owner on Jan 10, 2018. It is now read-only.
Added support for nesting in the combineReducers utility method. #214
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Current situation
During design of your state tree, you typically divide it up into different sections. F.e.
NGRX/Store provides the combineReducers method to easily work with such structures.
Problem description
If you want to work with multiple levels of nesting in your state tree, you need to do something else F.e.
In that case, you'd could:
Improvement description
Option 1 provides you with extra work and option 2 forces you to work with a third party library. I personally prefer option 3 where you nest the combineReducers method inside your tree.
This could actually be easily integrated into the current combineReducers method and make the following possible:
It's a lot cleaner than approach where you nest the combineReducers method yourself.
This implemented by making the combineReducers function a recursive one.
Happy to hear any feedback on the feature request/implementation :).
I also created test for this functionality. If you feel these are insufficient or not in the correct place/file, I'm happy to change this as per your instructions.