Nick
Nick

Reputation: 59

How to initialize redux-form fields with data received via ajax/axios api call?

I have managed to successfully pass initial values for my form fields with

export default reduxForm({
  form: "Item",
  initialValues: {name: "blah"}
  keepDirtyOnReinitialize: true,
  enableReinitialize: true,
  updateUnregisteredFields: true
})(Item);

but I am failing to pass a value which I am receiving from an action I am dispatching in componentDidMount().

How would I go about achieving this?

Upvotes: 0

Views: 109

Answers (1)

arunmmanoharan
arunmmanoharan

Reputation: 2675

Once you receive props from reducer, map them to the value property in each field of the form.

Upvotes: 1

Related Questions