title: Unpack content of the reducer into combineReducers
body: <p>I am trying to create a small application and figure out what's the best approach to organizing reducers in it. I want to load JSON from application state and want it to look like this:</p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;fruits&quot;: [
      {&quot;apple&quot;: 1},
      {&quot;banana&quot;: 2},
      {&quot;avocado&quot;: 1}
    ],
    &quot;vagetables&quot;: [
      {&quot;onion&quot;: 1},
      {&quot;beetroot&quot;: 2},
      {&quot;celeriac&quot;: 3}
    ],
  &quot;milk&quot;: &quot;1 bottle&quot;,
  &quot;sugar&quot;: &quot;1 kg&quot;,
  &quot;flour&quot;: &quot;1 kg&quot;
  }
  </code></pre>
  <p>The application has 2 reducers that return lists for fruits and vegetables, but there is also a third one that returns an object with all other fields like milk, sugar, and so on. And I want to understand if it is possible to somehow unpack the contents of this reducer into a root reducer:</p>
  <pre class="lang-js prettyprint-override"><code>//fruitReducer.js
  const initialState = {}
  
  export const fruitReducer = (state = initialState, action) =&gt; {
    switch (action.type) {
          case ADD_FRUIT:
               return {...state, [action.payload.name]: action.payload.value }
    }
  }
  
  
  //vagetablesReducer.js
  const initialState = {}
  
  export const vagetablesReducer = (state = initialState, action) =&gt; {
    switch (action.type) {
          case ADD_VAGETABLE:
               return {...state, [action.payload.name]: action.payload.value }
    }
  }
  
  //otherGoodsReducer.js
  const initialState = {}
  
  export const otherGoodsReducer = (state = initialState, action) =&gt; {
    switch (action.type) {
          case ADD_OTHER_GOOD:
               return {...state, [action.payload.name]: action.payload.value }
    }
  }
  
  
  //rootReducer.js
  rootReducer = combineReducers({
        vagetables: vagetableReducer,
        fruits: fruitReducer,
        //need to unpack other products here
  })
  </code></pre>
  <p>I would also like to figure out what is good practice in this case. I just have a lot of identical inputs for milk, sugar, etc. and it was convenient for me to process them with one reducer. But now I cannot figure out how to form a JSON suitable for me (It doesn't work for me if a separate key will be created for these objects.).</p>