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

116
Visualizações
Reset individual form input without re-rendering entire app in React?

My app gets initialized with a json payload of 'original values' for attributes in a task form. There is a shared state submissionState between various components in the app as children of a context provider which is a copy of the original values json but includes any edits made to attributes in the form. I would like to include individual 'reset' buttons for each input of the form which would update submissionState by setting the value for that input field to the original value in the json payload.

Code here: https://codesandbox.io/s/infallible-smoke-wtom9m

However, whenever I implement a reset button on a form input the entire app resets, even if I use e.preventDefault. Am I calling prevent default wrong and I just cant see the console error because the app is reseting?

about 4 years ago · Juan Pablo Isaza
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