title: Redux a better way to write reducers?
body: <p>I think the Redux holds a lot of great value however the main issue for me lies with how reducers are written today:</p>
  
  <pre><code>const addToDoReducer = (state, action) =&gt; {
      switch (action.type) {
          case ADD_TODO:
              return Object.assign({}, state, {
                  todos: todos(state.todos, action)
              })
          case TOGGLE_TODO:
              return Object.assign({}, state, {
                  todos: todos(state.todos, action)
              })
          default:
              return state
      }
  }
  </code></pre>
  
  <ul>
  <li>reducers are too generic (you can literally write bloated reducer that handles all sorts of different actions and easily create a mess) if nothing else this breaks single responsibility principle</li>
  <li>switch statement impose maintenance-side effects like changes to one case could break other cases (e.g. code that already works)</li>
  <li>always repeated "default: return state" (fails DRY)</li>
  <li>all reducers are always invoked (calling functions to do nothing is just wrong)</li>
  </ul>
  
  <p>... this at the end reducers become the weak/bridle spot of the project</p>
  
  <p><strong>Q: Is there a better way/option to write reducer that:</strong></p>
  
  <ul>
  <li>gets invoked only for specific action (based on the type of action object)</li>
  <li>eliminates switch statement</li>
  </ul>
  
  <p>something more like this:</p>
  
  <pre><code>const addToDoReducer = (state:toDoState, action:addAction) =&gt;
  {
      return { ...state, toDos: [...state.toDos, action.toDoObject] };
  }
  </code></pre>
  
  <p>Or is there a library that does this already?</p>