renderRoutes does not need to be wrapped in <Switch /> because according to the source code, renderRoutes already wrap <Routes /> in <Switch />.
Pushed <Header /> down a component level so <Header /> can receive route to know which component is currently selected. This is helpful for indicating an active status for the tab in the navbar that correspond to the selected page.
Added .active styles to the css and created the logic in the <Header /> to underline the tab corresponding to the current page.
A few improvements
renderRoutes
does not need to be wrapped in<Switch />
because according to the source code,renderRoutes
already wrap<Routes />
in<Switch />
.<Header />
down a component level so<Header />
can receiveroute
to know which component is currently selected. This is helpful for indicating an active status for the tab in the navbar that correspond to the selected page..active
styles to the css and created the logic in the<Header />
to underline the tab corresponding to the current page.