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

85
Views
React Router v6 warning on nested index routes

The following code (codesandbox) produces this warning when the root url is navigated to:

You rendered descendant (or called useRoutes()) at "/" (under <Route path="">) but the parent route path has no trailing "*"...

However, no warning is issued if I navigate to "/post/blah".

import { Routes, Route} from "react-router-dom";



const StreamPage = () => (
  <>
        <Routes>
            <Route index element={<div /> } />
            <Route path="post/:subslug/*" element={<div /> }/>
        </Routes>

      <Routes>
        <Route index element={<div />} />
        <Route path="post/:subslug/*" element={<div />} />
      </Routes>
  </>
)


export const App = () => (
      <Routes>
        <Route path="/" >
          <Route path="post/*" element={<StreamPage  />} />
          <Route index element={<StreamPage />} />
        </Route>
      </Routes>
  )

I know, I could fix the code by merging the two Routes blocks in StreamPage but I'm asking if this is expected behavior and if so what part of the react-router usage contract/API I'm violating? For instance, am I not allowed to have don't have sibling index routes under an index route? If I don't understand when/why this warning is produced I won't be able to avoid it in the future.

(related to this earlier question)

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!