title: React/Redux reducer returned undefined during initialization
body: <p>I'm working on my first React/Redux project. Everything was going fine, and then I tried to create a new reducer. I thought it was a pretty simple one, but when I load the page I get an error "Reducer X returned undefined during initialization." The trace says this is happening in combineReducers(). I found a couple of similar questions, but they didn't solve the issue.</p>
  
  <p>On this question: <a href="https://stackoverflow.com/questions/36619093/why-do-i-get-reducer-returned-undefined-during-initialization-despite-pr?s=2|2.3273">Why do I get “Reducer [...] returned undefined during initialization” despite providing initialState to createStore()?</a></p>
  
  <p>The issue was that they were using initialState in createStore(), which I'm not doing.</p>
  
  <p>On this question: <a href="https://stackoverflow.com/questions/38015896/why-does-my-redux-reducer-think-my-state-is-undefined">Why does my Redux reducer think my state is undefined?</a></p>
  
  <p>The problem was a missing default return value in the reducer, which I have. </p>
  
  <p>My reducer code is below. I have a console.log() at the beginning and it is not being called at all. </p>
  
  <p>reducers/reducer_which_sorter.js</p>
  
  <pre><code>import { SORT_CAMPERS } from '../actions/index';
  
  export default function(state = null, action) {
      console.log("action is", action);
      switch(action.which) {
          case 'recent':
          case 'alltime':
              return action.which;
              break;
          default:
              return state;
      }
  
      return state;
  }
  </code></pre>
  
  <p>reducers/index.js</p>
  
  <pre><code>import { combineReducers } from 'redux';
  import Campers from './reducer_camper_list';
  import ActiveSorter from './reducer_which_sorter';
  
  const rootReducer = combineReducers({
    campers: Campers,
    activeSorter: ActiveSorter
  });
  
  export default rootReducer;
  </code></pre>
  
  <p>Everything compiles fine. No errors from webpack. I've double, triple and quadruple checked my file paths. I don't see any typos. Can anyone see something I am missing here?</p>