Skip to content

BeforeRouteHook

ts
type BeforeRouteHook: (to, context) => MaybePromise<void>;

Represents a function called before a route change, potentially altering the routing operation.

Parameters

ParameterTypeDescription
toResolvedRouteResolvedRoute The resolved route the router is navigating to.
contextBeforeRouteHookContextBeforeRouteHookContext The context providing functions and state for the routing operation.

Returns

MaybePromise<void>