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

141
Vistas
React Formik and Checkbox

I need to map dynamicaly on a array. This array can change with a search field and i need to know what checkbox are checked to send my data with a submit but i dont find the right way to do to check the checkbox with Formik. This is my code :

const initialValues = {
    checked: [],
  };

  const onSubmit = (values) => {
    console.log(values);
  };

<Formik onSubmit={onSubmit} initialValues={initialValues}>
          {({ values, handleSubmit }) => (
            <form
              onSubmit={handleSubmit}
              noValidate={true}
            >
              {Listing.map((Search, index) => {
                if (
                  Search.installationAddress.includes(
                    searchMeter
                  ) ||
                  Search.deviceId.includes(searchMeter)
                ) {
                  return (
                    <div
                      key={index}
                    >
                      <Checkbox
                        color="text.standard"
                        label={`${Search.installationAddress}`+" Compteur N° " +`${Search.deviceId}`}
                        type="checkbox"
                        name="checked"
                        value={{
                          contractAccountId:
                            Search.contractAccountId,
                          deviceId: Search.deviceId,
                        }}
                        size="large"
                      />
                    </div>
                  );
                }
              })}
              
              <Checkbox
                color="text.standard"
                label="I confirm"
                onChange={() => setValidationButton(!validationButton)}
                value=""
                checked={validationButton}
              />
              <Button
                type="submit"
                disabled={!validationButton}
              
              >
               ACTIVATE
              </Button>
            </form>
          )}
        </Formik>
about 4 years ago · Santiago Trujillo
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