How to handleSubmit with a redux-form
Redux-Form decorates your component with handleSubmit
prop. According to docs it's:
a function meant to be passed to
<form onSubmit={handleSubmit}>
or to<button onClick={handleSubmit}>
. It will run validation, both sync and async, and, if the form is valid, it will callthis.props.onSubmit(data)
with the contents of the form data.Optionally, you may also pass your
onSubmit
function tohandleSubmit
which will take the place of theonSubmit
prop. For example:
So if your component doesn't have onSubmit
property you have to 'manually' pass your submit handler to handleSubmit
function. Please try this:
<form onSubmit={this.props.handleSubmit(this.handleSubmit.bind(this))}>
Please don't confuse your handleSubmit
method with prop passed from Redux-Form with the same name.