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

860
Views
Cambie la <Route path="/"> principal a <Route path="*">

Recibo esta advertencia en la aplicación React:

 You rendered descendant <Routes (or called `useRoutes()`) at "/" (under <Route path="/">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. Please change the parent <Route path="/"> to <Route path="*">.

Aquí está mi código:

 <Router> <Routes> <Route exact path="/login" element={<Login />} /> <Route exact path="/" element={<AppBody />} > <Route exact path="/add-edit-profile" element={<PageContent />} /> <Route exact path="/profile-list" element={<ProfileList />} /> </Route> </Routes> </Router>

AppBody.js:

 <Sidebar/> <div className='page-content'> <Header /> </div> <Routes> <Route exact path="/add-edit-profile" element={<PageContent />} /> <Route exact path="/profile-list" element={<ProfileList />} /> </Routes>

¿Qué debo cambiar en mi código para corregir la advertencia?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Significa que AppBody está representando rutas anidadas más profundas y la ruta debe especificar el carácter comodín * para indicar que puede coincidir con rutas más genéricas/anidadas. Las rutas de ruta react-router-dom siempre coinciden exactamente, por lo que si se procesan subrutas, la ruta debe permitirlas. Cambie path="/" a path="/*" .

Dado que AppBody representa las rutas y no tiene Outlet para los componentes de Route anidados, se pueden eliminar de forma segura.

 <Router> <Routes> <Route exact path="/login" element={<Login />} /> <Route exact path="/*" element={<AppBody />} > /> </Routes> </Router>
over 4 years ago · Santiago Trujillo 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!