# Function useRoutes

- useRoutes(routes, locationArg?): React.ReactElement | null

- Returns the element of the route that matched the current location, prepared with the correct context to render the remainder of the route tree. Route elements in the tree must render an `<Outlet>` to render their child route's element.

  #### Parameters

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

  #### Returns React.ReactElement | null

  #### See

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

  - 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:98