title: react The slice reducer for key "mods" returned undefined during initialization. (redux)
body: <p><strong>reducers/index.js</strong></p>
  <pre><code>import { combineReducers } from &quot;redux&quot;;
  import mods from &quot;./mods.js&quot;;
  
  export default combineReducers({ // &lt;----- error comes from here
      mods
  })
  </code></pre>
  <p><strong>reducers/mods.js</strong></p>
  <pre><code>import { GET_MODS } from &quot;../actions/types&quot;
  
  const initialState = {
      mods: [],
  }
  
  export default function(state = initialState, action) {
      switch(action.type) {
          case GET_MODS:
              return {
                  ...state,
                  mods: action.payload
              }
      }
  }
  </code></pre>
  <p>No idea why this is happening, I have done similiar things to this but have never encountered this problem, I am new to redux so its probably a stupid mistake...</p>
  <p>// The error</p>
  <p>Error: The slice reducer for key &quot;mods&quot; returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.</p>