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

422
Visualizações
React router v4 - Browser router not rendering parent component

Currently I'm trying to make it so that my parent router is activated each time. I'm not very sure of the terminology here.

<BrowserRouter>
  <Switch>
    <Route exact path='/browserRouterPath' component={loginComponent}/>
    <HashRouter>
      <Route path='/hashRouterPath' component={loginComponent2}/> 
      <Route path='/' component={loggedInComponent}/>
    </HashRouter>
  </Switch>
</BrowserRouter>

LoggedInComponent

<Switch>
<Route exact path='/' render={() => (
                             <Redirect to: {{pathname: '/finalComponent'> }}/> 
                             )}> />
...
</Switch>

My current problem is that my components in the hashRouter are not being called. When the loggedInComponent redirects it to the new path, the hashRouter is not called.

However, if I remove the hashRouter in the first block of code. The hashRouter is called without incident, but that breaks the CSS/styling of the components in the program.

Is there a way to render the parent component each time? Or is there a workaround that eliminates the hashRouter but keeps the CSS for me?

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