React Routeways - API ReferenceDocs


React Routeways - API Reference / useQueryParameters

Function: useQueryParameters()

useQueryParameters<T>(route): UseQueryParameters<ReturnType<T["parseUrl"]>["queryParams"]>

Returns a tuple of a stateful value of all query parameters, and a function to update them. Just like the useState hook would.

However, because the source of truth for this state is the current location, whenever the state is updated in one component, it will be also updated in other components using the same state from this hook. This keeps consistency across the state and the location all the time.

Type Parameters

T extends Routeway

Parameters

route: T

the Routeway route to use to parse the query parameters

Returns

UseQueryParameters<ReturnType<T["parseUrl"]>["queryParams"]>

a stateful value of the query parameters, and a function to update them

Defined in

src/lib/hooks/useQueryParameters.hook.ts:29