I'm trying to create a simple nested routing:
- App (root component, main navigation)
- Topic1 (sub-navigation)
- Topic1/Sub
- Topic2
My demo on Codesandbox has the following issues:
1. When navigating from /topic1
to /topic1/sub
, I expected the content from topic1
to show up and the content from topic1/sub
to be shown below, like this:
However, Topic 1
does not show anymore.
2. How can I avoid showing "App" twice?
I know I've added path: "/topic1", component: App,
but only because without it the routing did not work at all. As per the comments in router/index.js
:
component: App, // Option 1 - Navigation to topic1,2 and /sub works (why?) 'App' is displayed twice
component: Topic1, // Option 2 - Navigation to /sub does not work but at least 'App' is only displayed once
I seem to be missing something essential - thank you already for any answers.