useMatch

external fun useMatch(pattern: PathPattern): PathMatch?(source)
external fun useMatch(pattern: String): PathMatch?(source)

Returns a PathMatch object if the given pattern matches the current URL. This is useful for components that need to know "active" state, e.g. <NavLink>.

See also

https

://reactrouter.com/v6/hooks/use-match