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

240
Visualizações
Update URL in browser while scrolling a page in React

I am trying to create a smooth scrolling page in React. Let's say the page is split into 4 sections:

  • Who we are
  • About
  • Members
  • Alumni

So on scrolling, if it's at the section 'Members' with the id=members the URL should be updated to: website.com/who-we-are#members so he can copy this link, and when you access this URL to send you directly to that section.

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

0

You should use IntersectionObserver to determine if a section is in the viewport. Use a ref as target. Use an Effect hook to create the IntersectionObserver.

Then you can update the location per document.location.replace(). You can also use e.g. the convenient useHistory() hook of React Router.

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