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

258
Visualizações
Force page to re-render through popup

I am new to React. I have a question about how to force the page to render through a popup.

Now I wrote my page in a function component. And it has a popup window that could change the text on the page. However, the update will first go to the backend database and does not show on the page after submitting the popup form.

I know we can use windows.location.reload to reload the whole page. But I would like to know how I can re-render the function component instead of reloading the whole page.

Thank you so much!

Edit: This is a part of the code from the main page. values and setValues are created by [values, setValues] = useState({name: "", birthDate: ""});.

      <PopUpEdit 
        values={values}
        setValues = {setValues}
        trigger={buttonPopUpEdit} 
        setTrigger={setButtonPopUpEdit}
        >
          Edit
      </PopUpEdit> 

In the popup form,

const onSubmit = async(event)=>{
    event.preventDefault();
    props.setValues(event.target.value);
    props.setTrigger(undefined);
}

Both the main page and the popup form are function components. Thank you!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

in react js everything is based on state. you should add useState hook which is rendered with each change.

See also Basic Hook useState

enter image description here

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