---
title: useMatch
---

# useMatch

[MODES: framework, data, declarative]

## Summary

[Reference Documentation ↗](https://api.reactrouter.com/v7/functions/react_router.useMatch.html)

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

```tsx
useMatch(pattern): undefined
```

## Params

### pattern

[modes: framework, data, declarative]

_No documentation_

