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<Category>): UseCategoryReturn 

Parameters

NameTypeDescription
category
Ref<Category>

Return type

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

Properties

NameTypeDescription
category
ComputedRef<Category>
Current category entity

Usage

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

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