Appearance
useNavigationContext
Definition
Composable to get navigation context from the URL.
Basic usage
ts
const {
navigationContext,
routeName,
foreignKey
} = useNavigationContext(context);
Signature
ts
export function useNavigationContext(
context?: Ref<SeoUrl | null>,
): UseNavigationContextReturn
Parameters
Name | Type | Description |
---|---|---|
context | Ref<SeoUrl | null> |
Return type
See UseNavigationContextReturn
ts
export type UseNavigationContextReturn = {
/**
* SEO URL from the navigation context
*/
navigationContext: ComputedRef<SeoUrl | null>;
/**
* Route name from the navigation context
*/
routeName: ComputedRef<RouteName | undefined>;
/**
* Foreign key (ID) for current navigation context
*/
foreignKey: ComputedRef<string>;
};
Properties
Name | Type | Description |
---|---|---|
navigationContext | ComputedRef<SeoUrl | null> | SEO URL from the navigation context |
routeName | ComputedRef<RouteName | undefined> | Route name from the navigation context |
foreignKey | ComputedRef<string> | Foreign key (ID) for current navigation context |
Usage
ts
import { useNavigationContext } from "@shopware-pwa/composables-next";
const { product } = useNavigationContext();