useMatch
On this page

useMatch

Summary

Reference Documentation ↗

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>.

Signature

function useMatch<ParamKey extends ParamParseKey<Path>, Path extends string>(
  pattern: PathPattern<Path> | Path,
): PathMatch<ParamKey> | null

Params

pattern

The pattern to match against the current Location

Returns

The path match object if the pattern matches, null otherwise

Docs and examples CC 4.0
Edit