title: Can I mapDispatchToProps without mapStateToProps in Redux?
body: <p>I am breaking apart Redux' todo example to try to understand it. I read that <code>mapDispatchToProps</code> allows you to map dispatch actions as props, so I thought of rewriting <code>addTodo.js</code> to use mapDispatchToProps instead of calling dispatch(addTodo()). I called it <code>addingTodo()</code>. Something like this:</p>
  
  <pre><code>import React from 'react';
  import {connect} from 'react-redux';
  import addTodo from '../actions';
  
  let AddTodo = ({addingTodo}) =&gt; {
    let input;
    return (
        &lt;div&gt;
          &lt;form onSubmit={e =&gt; {
            e.preventDefault()
            if (!input.value.trim()) {
              return
            }
            addingTodo(input.value)
            input.value = ""
          }}&gt;
            &lt;input ref={node =&gt; {
              input = node
            }} /&gt;
            &lt;button type="submit"&gt;Submit&lt;/button&gt;
          &lt;/form&gt;
        &lt;/div&gt;
    )
  }
  
  const mapDispatchToProps = {
    addingTodo: addTodo
  }
  
  AddTodo = connect(
    mapDispatchToProps
  )(AddTodo)
  
  export default AddTodo
  </code></pre>
  
  <p>However, when I run the app, I get this error: <code>Error: Invalid value of type object for mapStateToProps argument when connecting component AddTodo.</code>. I never used <code>mapStateToProps</code> to begin with on AddTodo component, so I was not sure what was wrong. My gut feeling says that <code>connect()</code> expects <code>mapStateToProps</code> to precede <code>mapDispatchToProps</code>.</p>
  
  <p>The working original looks like this:</p>
  
  <pre><code>import React from 'react';
  import {connect} from 'react-redux';
  import addTodo from '../actions';
  
  let AddTodo = ({dispatch}) =&gt; {
    let input;
    return (
        &lt;div&gt;
          &lt;form onSubmit={e =&gt; {
            e.preventDefault()
            if (!input.value.trim()) {
              return
            }
            dispatch(addTodo(input.value))
            input.value = ""
          }}&gt;
            &lt;input ref={node =&gt; {
              input = node
            }} /&gt;
            &lt;button type="submit"&gt;Submit&lt;/button&gt;
          &lt;/form&gt;
        &lt;/div&gt;
    )
  }
  
  AddTodo = connect()(AddTodo)
  
  export default AddTodo
  </code></pre>
  
  <p>Complete repo can be found <a href="https://github.com/IggHub/understanding-redux" rel="noreferrer">here</a>.</p>
  
  <p>So my question is, is it possible to do mapDispatchToProps without mapStateToProps? Is what I am trying to do an acceptable practice - if not, why not?</p>