Reputation: 5535
I have a redux form with form fields as FieldArray. Initialising redux-form from state is pretty straightforward but my form has list of fields (FieldArray) and there is no documentation for initialising FieldArray form.
The problem seems to be because of field names (eg: members[0].lastName, members[0].firstName
etc)
And I've tried manually passing these keys but still got no form initialisation, please help.
Upvotes: 2
Views: 1190
Reputation: 5535
I found a workaround, we can add enableReinitialize: true
in form configuration object or we can use componentdidmout
and calling arrayInsert action and passing all the parameters. Used this github issue:
https://github.com/erikras/redux-form/issues/2349
Upvotes: 2
Reputation: 466
The name of FieldArray should have same name as the name of data you are going to pass in initialvalues of redux form.
fields props of Field Array component has data present only if we have pass valid name of Field Array
Upvotes: 0