I'm using react-router-dom V5. A simple version of my code is: Index.tsx:
ReactDOM.render(
<React.StrictMode>
<Router basename={urlExtra}>
<App />
</Router>
</React.StrictMode>,
document.getElementById("root")
);
App.tsx
function App() {
return (
<>
<NavBar />
<main css={content}>
<Switch>
<Route exact={true} path={"/"} component={Home} />
{Routes.map((routes: any) => (
<Route path={routes.path} key={routes.path} component={routes.component} />
))}
<Route path="*" component={NoMatch} />
</Switch>
</main>
</>
);
}
Navbar.tsx:
const NavBar: React.FC = () => {
const { organizationId, tenantId } = useParams();
....
since my Navbar is outside of my routing pages, it never gets updated and all of the parameters stay as 'undefined' when i switch pages. How can i tell the navbar links to update when a page change updates one of those values?