Skip to main content

useRouteRef()

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

React hook for constructing URLs to routes.

Signature:

function useRouteRef<TOptional extends boolean, TParams extends AnyRouteRefParams>(routeRef: ExternalRouteRef<TParams, TOptional>): TOptional extends true ? RouteFunc<TParams> | undefined : RouteFunc<TParams>;

Parameters

ParameterTypeDescription
routeRefExternalRouteRef<TParams, TOptional>The ref to route that should be converted to URL.

Returns:

TOptional extends true ? RouteFunc<TParams> | undefined : RouteFunc<TParams>

A function that will in turn return the concrete URL of the routeRef.

Remarks

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