Skip to main content

Function: useLink()

useLink(): (routeName, params) => string

Defined in: packages/react-page-renderer/src/hooks/link.ts:14

Provides direct access to Router link function.

Returns

URL to linked path.

(routeName, params): string

Generates an absolute URL (including protocol, domain, etc) for the specified route by substituting the route's parameter placeholders with the provided parameter values.

Parameters

routeName

string

The unique name of the route, identifying the route to use.

params

RouteParams

Parameter values for the route's parameter placeholders. Extraneous parameters will be added as URL query.

Returns

string

An absolute URL for the specified route and parameters.

Example

const link = useLink();