Compares two Route objects.
reqiureExact is true, this function will return
specific are identical.
Use this when you want to know if two routes are exactly the same.
requireExact is false, this function will return
true if the
partial route does not contain any information which differs from that in the
Use this when you want to know if the active route is a child of some arbitrary route. For example, when you want to highlight menu items.
requireExact(bool): If false, will also return true for partial matches
This function is used to handle the highlighting for the side menus on the Junctions website.
This website uses a custom
<Link> component which accepts the page’s current
Route via React Context. It then compares the given route with the current route to decide whether to highlight the menu item.
const active = this.context.currentRoute && routesMatch(this.context.currentRoute, route, false)