title: is it possible to have nested reducers in redux?
body: <p>given an app with initialStore = { users :{} } where every user is stored inside users by its id as a key, if a component shows list of users, when updating a single user inside this object, the whole list is re-rendered which is expected since the reducer did return a new object as a state although all that the reducer actually needed was changing a single key.</p>
  
  <p>Example code</p>
  
  <pre><code>ducks/users.js
  const LoadAllAction = ()=&gt;({ type:'USERS/LOAD',users:{1:{id:1,if:0},2:{id:2,if:0}} });
  const LoadSingleAction = ()=&gt;({ type:'USERS/SINGLE',user:{id:2,if:1} });
  
  //THIS REDUCER HANDLE THE USERS SLICE OF STORE
  const reducer = (state={},action)=&gt;{
  
  if(action.type === 'USERS/LOAD')return action.users;
  
  if(action.type === 'USERS/SINGLE')return Object.assign({},state,{[action.user.id]:action.user});
  
  return state;
  }
  
  const rootReducer = combineReducers({users:reducer});
  const store = createStore(rootReducer, {users:{}});
  </code></pre>
  
  <p>above is a setup of the problem i'm investigating.. now given a simple React component that use connect to subscribe to store</p>
  
  <pre><code>const UsersPage = props=&gt;(
      &lt;ul&gt; 
           {Object.keys(props.users).map((u)=&gt;(
             &lt;li key={u.id}&gt;ID :: {u.id}&lt;/li&gt;
           ))}
      &lt;/ul&gt;
    );
  
  const mapStateToProps(state)=&gt;({users:state.users});
  
  const component = connect(mapStateToProps)(UsersPage);
  </code></pre>
  
  <p>now in component above, if a single user is changed the users store, the whole usersPage component will re-render.</p>
  
  <p>given that users store can hold above 10,000 user. how can i upgrade my reducers/redux structure so that when a single user inside the users store is updated.. only components that listen to this single user re-render ?</p>
  
  <p>i tried to split the above ul into two components puting li into separate component and connecting it to redux view connect passing the </p>
  
  <pre><code>///LiComponent connect function example
  const mapStateToProps(state,ownProps)=&gt;({users:state.users[ownProps.key]});
  </code></pre>
  
  <p>yet it now both ul, and li re-renders. so it occured to me that the problem is that my reducer return a new users store every time it needs to update a single user, so i need to have a sub reducer for every user if i want to prevent this from happening.</p>
  
  <p>but from what i understand redux store need to be flat and reducers only slice by keys, not by sub keys.</p>
  
  <p>-is it possible/ AND NORMAL/ that you nest reducers in redux ?</p>
  
  <p>by normal i mean i saw tons of simple todos apps around that never saw a real world large scale app structure out there that can guide us out of this, so how does redux gurus does this while planing there apps ?</p>