React Routeways - API ReferenceDocs


React Routeways - API Reference / usePathVars

Function: usePathVars()

usePathVars<T>(route): UsePathVars<ReturnType<T["parseUrl"]>["pathVars"]>

Returns a tuple of a stateful value of the path variables, and a function to update them. Just like the useState hook would.

However, because changing path variables means that the current location may also be different, an update to the path variables will produce a navigate using the updated values.

Type Parameters

T extends Routeway

Parameters

route: T

the Routeway route to use to parse the path variables

Returns

UsePathVars<ReturnType<T["parseUrl"]>["pathVars"]>

a stateful value of the path variables, and a function to update them

Defined in

src/lib/hooks/usePathVars.hook.ts:26