Limit Matching Between Path and the URL

Learn how to return the Route if the path is an exact match to the current URL, and also how to render only the first Route that matches the URL rather than rendering all matching Routes.

Limit matching with props

To limit the matching between the path and the URL, React Router provides an exact prop on the Route component. If this Boolean prop is provided, the Route is only rendered if the path prop exactly matches the current URL. Let’s look at an example:

Get hands-on with 1200+ tech skills courses.