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

217
Visualizações
Use ScrollToTop in react (but not for every link - how to do it)

I need to use ScrollToTop, but not for every link. What is the best way to do this? Adding a function to every link where I want to use this function seems like the wrong way. I was also thinking about wrapping all components <ScrollToTop>(all components and routes)</ScrollToTop> and excluding only the places where I don't want to use it - just not sure how to do that. I've tried to find the answer, but I guess no one has asked this, or I can't find it.

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

0

If I understand your question, you can create a Higher order component which has this ScrollToTop functionality. See here

about 4 years ago · Juan Pablo Isaza Relatório

0

Try it

let scrollToTop = () =>{window.scrollTo(0,0)}

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