Skip to main content

New answers tagged

Best practices
0 votes
0 replies
0 views

What is a good way to find current route and render contents depending on it?

The matched URL path is the condition for which a route is matched and conditionally renders its content. If you need to render different headers/navbars/etc. for different routes, use separate layout ...
Drew Reese's user avatar
  • 208k
Best practices
0 votes
0 replies
0 views

What is a good way to find current route and render contents depending on it?

Solutions that React-Router provide are the use of layouts and nested routes. My question is not about how routing works, but how to make a conditional rendering exception in the layout or the parent ...
Veltro's user avatar
  • 33
Best practices
2 votes
0 replies
0 views

What is a good way to find current route and render contents depending on it?

This is the solution React-Router provides, its entire purpose. Use a router component and render the content you want to match specific URL paths with a Route component. The documentation explains ...
Drew Reese's user avatar
  • 208k
Best practices
0 votes
0 replies
0 views

What is a good way to find current route and render contents depending on it?

Use useMatch inside your NavbarCustom component.
moonwave99's user avatar

Top 50 recent answers are included