0

我是 Formik 的新手,一直在研究 FieldArray,想询问并获得一些关于以下设置是否真的可以使用 Formik FieldArray 的指导。

现在我的场景使用由两个选项组成的单选按钮,其中一个选项也可以有它自己的 FieldArray,即它是 FieldArray 中的 FieldArray。

我需要使用 Formik 构建的表单是这样的:

**FieldArray Top**

Donations Group #1:

(with the following two radio button selections)

o (this radio option has another FieldArray)
   
   institution                 donation($)     +
   institution                 donation($)     +  -
                                           Button: Add institution
or

o Upload CSV option
     


Donations Group #2:
    
(with the following two radio button selections)
    
o (this radio option has another FieldArray)
       
    institution                 donation($)     +
    institution                 donation($)     +  -
    institution                 donation($)     +  -
    institution                 donation($)     +  -
                                            Button: Add institution
or

o Upload CSV option

Button: Add Donation Group      (this would then create another instance of the above)

etc...

我知道我没有提供任何代码,但我想再问一次:

  1. 上面的表单设置与无线电组和嵌套的 FieldArray 实际上可以使用 Formik &

  2. 如果上述设置可行,我将不胜感激上述结构的代码布局以及我需要注意的任何内容。

4

0 回答 0