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

152
Views
¿Cómo evitar que el enrutador 5 reaccione para representar el componente DashboardLayout debajo de una ruta específica?

Estoy tratando de crear una ruta que funcione de la siguiente manera:

 <Route path='/home' exact component={Home}/> {loggedin && <DashboardLayout> <Route path='/settings' exact component={Settings} /> <Route path='/edit' exact component={AdMaker} /> </DashboardLayout> }

Si estoy conectado, el DashboardLayout está representando lo que no quiero si la ruta es /home. ¿Qué tengo que hacer? [Por favor, recomiende otros métodos que no sean el interruptor]

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Hay muchas formas diferentes de hacerlo, una de ellas es verificar el nombre de la pathname

 let location = useLocation(); let checkIsHome = () => { return location.pathname?.includes('home') } <Route path='/home' exact component={Home}/> {loggedin && !checkIsHome() && <DashboardLayout> <Route path='/settings' exact component={Settings} /> <Route path='/edit' exact component={AdMaker} /> </DashboardLayout> }
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!