Skip to main content

useRouteRef()

Home > @backstage/frontend-plugin-api > useRouteRef

React hook for constructing URLs to routes.

Signature:

function useRouteRef<TParams extends AnyRouteRefParams>(routeRef: RouteRef<TParams> | SubRouteRef<TParams> | ExternalRouteRef<TParams>): RouteFunc<TParams> | undefined;

Parameters

Parameter

Type

Description

routeRef

RouteRef<TParams> | SubRouteRef<TParams> | ExternalRouteRef<TParams>

The ref to route that should be converted to URL.

**Returns:**

RouteFunc<TParams> | undefined

A function that will in turn return the concrete URL of the routeRef, or undefined if the route is not available.

Remarks

See https://backstage.io/docs/plugins/composability#routing-system