Search code examples
reduxredux-form

Redux-form returns Proxy in OnSubmit handler


I try run the example code.

<form onSubmit={values => console.log("========>", values)}>
    <div>
      <label htmlFor="firstName">First Nameeee</label>
      <Field name="firstName" component="Input" type="text"/>
    </div>
    <div>
      <label htmlFor="lastName">Last Name</label>
      <Field name="lastName" component="Input" type="text"/>
    </div>
    <div>
      <label htmlFor="email">Email</label>
      <Field name="email" component="Input" type="email"/>
    </div>
    <button type="submit">Submit</button>
  </form>

But when i handle the onSubmit event the param values returns an Proxy instead an object with input values.

//Console.log output
Proxy {dispatchConfig: Object, _targetInst: ReactDOMComponent, _dispatchInstances: ReactDOMComponent, nativeEvent: Event, type: "submit"…}

Solution

  • Try this.props.handleSubmit(values => console.log("========>", values))

    instead of values => console.log("========>", values)