title: You must either pass handleSubmit() an onSubmit function or pass onSubmit as a prop | Redux Forms
body: <p>I want to create a simple form that takes in an email adress and later adds it to our database. I went with React Forms, because it facilitates the whole development process and reduces the amount of time. </p>
  
  <p>However, when I'm trying to POST my form I'm getting this error: <code>Uncaught Error: You must either pass handleSubmit() an onSubmit function or pass onSubmit as a prop</code></p>
  
  <p>Here's my <strong>AddUserForm.js:</strong></p>
  
  <pre><code>import React from 'react'
  import { Field, reduxForm } from 'redux-form'
  
  const AddUserForm = ({ handleSubmit }) =&gt; {
    return (
      &lt;form onSubmit={handleSubmit}&gt;
        &lt;div&gt;
          &lt;Field name="email" component="input" type="email" /&gt;
        &lt;/div&gt;
        &lt;button type="submit"&gt;Bjud in&lt;/button&gt;
      &lt;/form&gt;
    )
  }
  export default reduxForm({
    form: 'addUser'
  })(AddUserForm)
  </code></pre>
  
  <p>Here's my <strong>addUserAction:</strong></p>
  
  <pre><code>import axios from 'axios'
  import settings from '../settings'
  
  axios.defaults.baseURL = settings.hostname
  
  export const addUser = email =&gt; {
    return dispatch =&gt; {
      return axios.post('/invite', { email: email }).then(response =&gt; {
        console.log(response)
      })
    }
  }
  </code></pre>
  
  <p>And here's my <strong>AddUserContainer.js:</strong></p>
  
  <pre><code>import React, { Component } from 'react'
  import { addUser } from '../../actions/addUserAction'
  import AddUserForm from './Views/AddUserForm'
  import { connect } from 'react-redux'
  
  class AddUserContainer extends Component {
    submit(values) {
      console.log(values)
      this.props.addUser(values)
    }
  
    render() {
      return (
        &lt;div&gt;
          &lt;h1&gt;Bjud in användare&lt;/h1&gt;
          &lt;AddUserForm onSubmit={this.submit.bind(this)} /&gt;
        &lt;/div&gt;
      )
    }
  }
  
  function mapStateToProps(state) {
    return { user: state.user }
  }
  
  export default connect(mapStateToProps, { addUser })(AddUserContainer)
  </code></pre>
  
  <p>I am really grateful for all the answers! Stay awesome!</p>