Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

131
Vistas
Formik get same name field input

When I click add input, it brings another one from the same input, but this time the name property is the same. I tried to put it in the photos array with different names. but I couldn't. A string expression is entered into the photos input. How can I collect these inputs into photos:[] with formik

const{handleSubmit,handleChange,handleBlur,errors,touched} = useFormik({
    initialValues:{
      title:"",
      price:"",
      description:"",
      photos:[],
   
    },
    onSubmit:(values)=>{
     
     console.log(values);
    
     
    }
  })


{fields.map((field, index) => (
              <Form.Item
                
                label={"Product Image"}
                required={false}
                key={field.key}
              >
                <Form.Item
                  {...field}
                  
                  noStyle
                >
                  <Input name={fields.length > 1 ? `photos[${fields.length}]` : "photos[0]"} onChange={handleChange} onBlur={handleBlur} placeholder="Enter a image url..." style={{ width: '60%' }} />
                </Form.Item>
                {fields.length > 1 ? (
                  <MinusCircleOutlined
                    className="ms-1 dynamic-delete-button"
                    onClick={() => remove(field.name)}
                  />
                ) : null}
              </Form.Item>
            ))}
<Form.Item className="text-center">
              <Button
                type="dashed"
                onClick={fields.length < 5 ? () => add() : null}
              
                
              >
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda