# Function useMatch

- useMatch<ParamKey, Path>(pattern): PathMatch<ParamKey> | null

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

  #### Type Parameters

  - ParamKey extends string
  - Path extends string

  #### Parameters

  - pattern: Path | PathPattern<Path>

  #### Returns PathMatch<ParamKey> | null

  #### See

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

  - Defined in common/temp/node_modules/.pnpm/react-router@6.23.1_react@18.3.1/node_modules/react-router/dist/lib/hooks.d.ts:45