React/Redux reducer returned undefined during initialization

A Redux requirement is to use a type property on actions, not which, as you've done in your example. Since your console.log check isn't called, the problem could be in your other reducer (not shown in your question.)

The reason this matters is that combineReducers is calling your reducer functions with a special INIT action type:

const initialState = reducer(undefined, { type: ActionTypes.INIT })

Source: https://github.com/reactjs/redux/blob/master/src/combineReducers.js

Your function, since it switches on 'action.which' instead of 'action.type', fails to return anything except undefined.


I have a console.log() at the beginning and it is not being called at all.

It's strange, because the reducer function must have been called at least once with @@INIT action.

Try to test if your rootReducer is called at all. Change it to:

const rootReducer = (state = {}, action) => {
  console.log('Test if rootReducer is ever called')

  return {
    campers: Campers(state.campers, action),
    activeSorter: ActiveSorter(state.activeSorter, action)
  }
}

If it's not being called, then the problem is somewhere higher, not in the reducer itself.