I'm trying to access to sub components with nested routing in React using react-router-dom 5.2.0. Here you can find a CodeSandbox link of the project: https://codesandbox.io/s/nested-routes-8c7wq?file=/src/App.js
First, let me show you the tree structure of my pages.
- Home
- About
- Organisations
- MainContent
- SecondContent
Routes for main pages (Home, About, Organizations) are in src/routes folder. So their link look like:
- https://localhost:3000/ (for Home)
- https://localhost:3000/about (for About)
- https://localhost:3000/organizations (for Organizations)
At this point, everything is okay for me. The problem is with the nesting part..
On Organizations page, I have to be able to switch between MainContent and SecondContent. So links into that page must look like this:
But I cannot print any of those contents...