Skip to content
On this page

useCategory ​

Definition ​

Composable to get the category from current CMS context

Basic usage ​

ts
const {  category } = useCategory(category);

Signature ​

ts
export function useCategory(
  category?: Ref<Schemas["Category"]>,
): UseCategoryReturn 

Parameters ​

NameTypeDescription
category
Ref<>

Return type ​

See UseCategoryReturn
ts
export type UseCategoryReturn = {
  /**
   * Current category entity
   */
  category: ComputedRef<Schemas["Category"]>;
};

Properties ​

NameTypeDescription
category
ComputedRef<>
Current category entity

Usage ​

ts
import { useCategory } from "@shopware-pwa/composables-next";

const { search } = useCategory();
useCategory has loaded