Skip to content

(V6.0.0-rc.4) Action creator no available in props while using reduxForm call. #1532

@asincrono

Description

@asincrono

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions