Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

420
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!