Setting initial values to dynamic form in antd 4

Viewed 10579
1 Answers

You need to pass an object to initialValues prop, that contains an array of values for names field list, like so:

    <Form
      name="dynamic_form_item"
      initialValues={{ names: ['', '', ''] }}
      {...formItemLayoutWithOutLabel}
      onFinish={onFinish}
    >
        <Form.List name="names">
            { /* your array of fields goes here */ }
        </Form.List>
    </Form>

Related