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

187
Visualizações
Why does React BrowserRouter not return each component based on URL as it should?

I'm fairly new to React and am trying to get the BrowserRouter to render properly. However, when this renders:

ReactDOM.render(
  <ApolloProvider client={client}>
    
    <Router>
      <Routes>
        <Route element={<Nav />} />
        <Route path="/" element={<Search />}>
            <Route path="search" element={<Content />} />
        </Route>
      </Routes>
    </Router>
  </ApolloProvider>,
  document.getElementById('root')
)

All that shows up on the page is the Search bar, regardless of whether I'm at the index or at /search. I would like the Nav and Search elements to show up on all pages, and for any nested component to appear only at its specified route (e.g. /search for Content) I imported BrowserRouter as Router. Any help is greatly appreciated!

about 4 years ago · Santiago Trujillo
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