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

97
Views
Reactjs screen is not rendering

I think that the problem is in the switch, in version of react-router-dom or in routes. Only when I created and applied the code in this class, the screen started don't render and stays white. I already changed the version of react-router-dom but I don't know what can be. Below the code of routes.js:

//react-router-dom version: "^5.3.0"
import {BrowserRouter, Route, Switch} from 'react-router-dom';
import Home from './pages/Home';
import Header from './components/Header';

const Routes = () => {
    return(
        <BrowserRouter>
            <Header/>
            <Switch>
                <Route exact path="/" component={Home}/>
            </Switch>
        </BrowserRouter>
    )
}

export default Routes;
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

React Router v6 introduces some changes like.

Routes component that is kind of like Switch, but a lot more powerful one.

Route still exist but you don't pass a pointer to that component function or as a children component, Instead you pass the JSX element to the element prop & exact doesn't exist anymore, now it's always looks for exact matches.

So, component={Home} would become element={<Home />}

Something like this

<Routes>
    <Route path="/" element={<Home />} />
    <Route path="about" element={<About />} />
</Routes> 

You can dive deep to this migration guide: https://reactrouter.com/docs/en/v6/upgrading/v5

hope that's help you

about 4 years ago · Juan Pablo Isaza Report
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!