Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

202
Visualizações
How to use Formik's handleChange multiple times to change the same value?

I use Material-UI and Formik. I want that two input fields can edit a single value. In this case there is a TextField and a Slider and both of those inputs should allow to change the value for the perdiod. When I give both input fields the same id I get the following error message, which I kinda expected: Formik cannot determine which value to update

But is there a way to do that with Formik or do I need to write a custom handleChange function?

const formik = useFormik({
    initialValues: {
      period: 5,
    },
<OutlinedInput
 id="period"
 name="period"
 type="period"
 onChange={formik.handleChange}
 value={formik.values.period}
/>


<Slider 
  value={formik.values.period}
  aria-label="Default" 
  min={0}
  max={20}
  id="period"
  onChange={formik.handleChange}
/>
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

dont give them the same id , but give them the same name

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda