Skip to main content

useRoutes

useRoutes(routes: RouteObject[],locationArg: string | Partial<Location>): 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.

Properties

(Mandatory properties are in bold)
PropertiesTypeDescription
routesRouteObject[]
Additional properties for advanced use cases
PropertiesTypeDescription
locationArgstring | Partial<Location>