# Function matchRoutes

- matchRoutes<RouteObjectType>(routes, locationArg, basename?): AgnosticRouteMatch<string, RouteObjectType>[] | null

- Matches the given routes to a location and returns the match data.

  #### Type Parameters

  - RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject

  #### Parameters

  - routes: RouteObjectType[]
  - locationArg: string | Partial<Location<any>>
  - `Optional` basename: string

  #### Returns AgnosticRouteMatch<string, RouteObjectType>[] | null

  #### See

  https://reactrouter.com/utils/match-routes

  - Defined in common/temp/node_modules/.pnpm/@remix-run+router@1.16.1/node_modules/@remix-run/router/dist/utils.d.ts:323