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

126
Visualizações
Tracking state in URL params over multiple React components

I have a page which shows a list of items. These items are paginated, and can be searched, filtered, and ordered.

IndexComponent
-> SidebarComponent
   -> FilterComponentA
   -> OrderComponentB
-> ListContainerComponent
   -> SearchComponent
   -> PaginatedListComponent

There are several components here which have state related to the list which I want in the URL for page reload/URL sharing etc. The problem is that if we use react-router's useSearchParams() hook over multiple components they all end up with different versions of the searchParams and end up overriding each other due to immutability.

What is the best way to handle this situation so that we have minimal re-renders or state changes, without having to hardcode in the child state into the parent components (SidebarComponent shouldn't need to know if we add an extra filter option)?

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