<Route path="/exercises" element={List}>
<Route path=":id" element={Exercise} />
</Route>
The urls:
/exercises
/exercises/15
When the user accesses /exercises they see a list of titles of exercises. They can click on the title and go to the exercise. When then go to e.g. /exercises/15 they should see that exercise.
The key point is that when the Exercise component renders we don't want the List component to render at all. They are different things.
The examples in the documentation seem to be about the case when e.g. you have a list of Messages and you still want to see that list when you render an individual Message. In such a case you would render the component for the Individual Message by using <Outlet> in Messages. The user sees the list of Messages and the individual message.
But in my case I just want the individual 'final' component to render.
So I think that from the React Router point of view this is not a nested route at all? On that basis I've tried:
<Route path="exercises" element={List} />
<Route path="exercises/:id" element={Exercise} />
This works in fact. Is this the correct way to do it?