title: Uncaught TypeError: Cannot read property 'type' of undefined at start of switch function
body: <p>I'm trying to use move my app to redux-react from pure react. I made an action and reducer for onClick but after trying to start the app in dev mode I get this error</p>
  
  <pre><code>Uncaught TypeError: Cannot read property 'type' of undefined at reducerDomMethods (manMethodsReducers.js:12) 
  </code></pre>
  
  <p>which is this line </p>
  
  <pre><code>switch (action.type) {  
  </code></pre>
  
  <p>This is my code</p>
  
  <p>reducer</p>
  
  <pre><code>export default function reducerDomMethods(state={
  isClicked: false,
  }, action) {
  switch (action.type) {
      case "CLICK_OPEN": {
          return {
              ...state,
              isClicked: true
          }
      }
  
      case "CLICK_CLOSE": {
          return{
              ...state,
              isClicked:false
          }
      }
  
          return state;
    }
  }
  </code></pre>
  
  <p>action</p>
  
  <pre><code>export function clicking(isClicked) {
  
  return function (dispatch) {
  
              if( isClicked === true){
                  dispatch({type: "CLICK_OPEN",isClicked: true});
              }else {
                  dispatch({type: "CLICK_CLOSE",isClicked: false});
              }
     }
  }
  </code></pre>
  
  <p>combine reducer</p>
  
  <pre><code>    import { combineReducers } from "redux"
  
      import cityName from "./apiReducers"
      import nameOfCity from "./apiReducers"
      import weatherDescription from "./apiReducers"
      import windSpeed from "./apiReducers"
      import temperature from "./apiReducers"
      import maxTemperature from "./apiReducers"
      import minTemperature from "./apiReducers"
      import isClicked from "./manMethodsReducers"
  
      export default combineReducers({
          cityName,
          nameOfCity,
          weatherDescription,
          windSpeed,
          temperature,
          maxTemperature,
          minTemperature,
          isClicked
      })
  </code></pre>
  
  <p>store</p>
  
  <pre><code>import { applyMiddleware, createStore } from "redux"
  
  import logger from "redux-logger"
  import thunk from "redux-thunk"
  import promise from "redux-promise-middleware"
  
  import reducer from "./reducers"
  import reducerDomMethods from "./reducers"
  
  const middleware = applyMiddleware(promise(), thunk, logger())
  
  export default createStore( reducer , reducerDomMethods, middleware)
  </code></pre>
  
  <p>connect</p>
  
  <pre><code>    import {connect} from "react-redux"
  
  @connect((store) =&gt; {
  
      return {
         nameOfCity:store.nameOfCity.nameOfCity,
         weatherDescription:store.weatherDescription.weatherDescription,
         windSpeed:store.windSpeed.windSpeed,
         temperature:store.temperature.temperature,
         maxTemperature:store.maxTemperature.maxTemperature,
         minTemperature:store.minTemperature.minTemperature,
         isClicked:store.isClicked.isClicked,
        }
       })
  </code></pre>
  
  <p>EDIT: This is where I am importing sending the action</p>
  
  <pre><code>        import React, {Component} from 'react';
          import SearchBar from '../components/SearchBar';
          import {connect} from "react-redux"
          import {fetchWeatherData} from "../actions/weather-apiActions";
          import {clicking} from '../actions/manMethodsActions'
  
          @connect((store) =&gt; {
              return {
                  nameOfCity:store.nameOfCity.nameOfCity,
                  weatherDescription:store.weatherDescription.weatherDescription,
                  windSpeed:store.windSpeed.windSpeed,
                  temperature:store.temperature.temperature,
                  maxTemperature:store.maxTemperature.maxTemperature,
                  minTemperature:store.minTemperature.minTemperature,
                  isClicked:store.isClicked.isClicked,
              }
          })
  
          class FormContainer extends Component {
  
              handleFormSubmit(e) {
                  e.preventDefault();
                  var cName = e.target.CityName.value;
                  console.log(cName);
                  let isClicking = false;
                  this.props.dispatch(clicking(isClicking));
                  this.props.dispatch(fetchWeatherData(cName));
              }
  
              render() {
  
                  return (
  
  
                      &lt;div&gt;
                      &lt;form onSubmit={this.handleFormSubmit.bind(this)}&gt;
                          &lt;label&gt;{this.props.label}&lt;/label&gt;
  
  
                          &lt;SearchBar
                                  name="CityName"
                                  type="text"
                                  value={this.props.cityName}
                                  placeholder="search"
                              /&gt;
  
                          &lt;button type="submit" className="" value='Submit' placeholder="Search"&gt;Search&lt;/button&gt;
                      &lt;/form&gt;
                      &lt;/div&gt;
                  );
              }
          }
  
          export {FormContainer};
  </code></pre>