#250·router

Params not Propagated to Nested Routes with default prop

Author: recipherCreated Mar 4, 2019Updated Nov 22, 2024
Labelsbug

Question?

Given this route structure:

<Router>
  <Users path='/users'>
    <User path=':userId'>
      <Roles path='roles'/>
   </User>
  </Users>
</Router>

Should userId be a prop on the Roles component?

Update

After some further investigation, the code above will pass the userId prop to the Roles component. However, if I do this:

<Router>
  <Users path='/users'>
    <User path=':userId'>
      <Roles default path='roles'/>
   </User>
  </Users>
</Router>

Or indeed this:

<Roles default>

If I add default to the route, then the userId param is not propagated as a prop to the Roles component. This seems like a bug to me?