-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Description
I'm trying to call an action creator when I push the submit button.
First I import my action creator loginRequest
import loginRequest from '../../actions/loginActions'
Then I write a class method that will call that action creator (as it should be accessible via props)
class LoginForm extends Component {
constructor(props) {
super(props)
this.handleFormSubmit = this.handleFormSubmit.bind(this)
}
handleFormSubmit ({ email, password }) {
console.log('hola')
this.props.loginRequest(email, password)
}
In my form I have the handlesubmit call
render () {
const {handleSubmit, reset, pristine, submitting, valid } = this.props
return (
<form onSubmit={handleSubmit(this.handleFormSubmit)}>
<Field
name="email"
label="Email"
...
Finally I call reduxForm
to make the action creator accessible via props:
export default reduxForm(formOptions, null, { loginRequest })(LoginForm)
But inside handleFormSubmit
I'm unable to see the property loginRequest
. As it's undefined.
I don't understand what is happening. Shouldn't the action creators passed to reduxForm
third argument visible in the LoginForm props?
Metadata
Metadata
Assignees
Labels
No labels