File tree Expand file tree Collapse file tree 1 file changed +0
-48
lines changed
packages/ra-core/src/form Expand file tree Collapse file tree 1 file changed +0
-48
lines changed Original file line number Diff line number Diff line change @@ -125,51 +125,3 @@ export const Large = () => {
125125 </ CoreAdminContext >
126126 ) ;
127127} ;
128-
129- const FieldArray = ( ) => {
130- const { fields } = useFieldArray ( {
131- name : 'arrayField' ,
132- } ) ;
133- return (
134- < div style = { { display : 'flex' , flexDirection : 'column' , gap : '1em' } } >
135- { fields . map ( ( field , index ) => (
136- < Input key = { field . id } source = { `arrayField.${ index } .name` } log />
137- ) ) }
138- </ div >
139- ) ;
140- } ;
141- export const ArrayOfFields = ( ) => {
142- const formValue = useForm ( {
143- defaultValues : {
144- arrayField : Array . from ( { length : 50 } , ( _ , index ) => ( {
145- id : index + 1 ,
146- name : `Item ${ index + 1 } ` ,
147- } ) ) ,
148- } ,
149- } ) ;
150- const [ submittedData , setSubmittedData ] = React . useState < any > ( ) ;
151- return (
152- < CoreAdminContext >
153- < FormProvider { ...formValue } >
154- < form
155- onSubmit = { formValue . handleSubmit ( data =>
156- setSubmittedData ( data )
157- ) }
158- >
159- < div
160- style = { {
161- display : 'flex' ,
162- flexDirection : 'column' ,
163- gap : '1em' ,
164- marginBottom : '1em' ,
165- } }
166- >
167- < FieldArray />
168- </ div >
169- < button type = "submit" > Submit</ button >
170- </ form >
171- </ FormProvider >
172- < pre > { JSON . stringify ( submittedData , null , 2 ) } </ pre >
173- </ CoreAdminContext >
174- ) ;
175- } ;
You can’t perform that action at this time.
0 commit comments