useRoutes

external fun useRoutes(routes: ReadonlyArray<RouteObject>, locationArg: Location<*> = definedExternally): ReactElement<*>?(source)
external fun useRoutes(routes: ReadonlyArray<RouteObject>, locationArg: String = definedExternally): ReactElement<*>?(source)

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.

See also

https

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