GitHub

DaffCategoryMemoizedSelectors

An interface for selectors that combine category metadata and category entities selectors.

import { DaffCategoryMemoizedSelectors } from '@daffodil/category/state'
interface DaffCategoryMemoizedSelectors<V extends DaffGenericCategory<V> = DaffCategory, W extends DaffProduct = DaffProduct> {
  selectCurrentCategory: MemoizedSelector<DaffCategoryStateRootSlice<V>, V>
  selectCategoryPageProducts: MemoizedSelector<DaffCategoryStateRootSlice<V, W>, W[]>
  selectCategory: (categoryId: V['id']) => MemoizedSelector<DaffCategoryStateRootSlice<V>, V>
  selectProductsByCategory: (categoryId: V['id']) => MemoizedSelector<DaffCategoryStateRootSlice<V, W>, W[]>
  selectTotalProductsByCategory: (categoryId: V['id']) => MemoizedSelector<DaffCategoryStateRootSlice<V>, number>
}

Properties

Name Type Description
selectCurrentCategory MemoizedSelector<DaffCategoryStateRootSlice<V>, V>

Selects the current category

selectCategoryPageProducts MemoizedSelector<DaffCategoryStateRootSlice<V, W>, W[]>

Selects the products of the current category.

selectCategory (categoryId: V['id']) => MemoizedSelector<DaffCategoryStateRootSlice<V>, V>

Selects a category by id.

selectProductsByCategory (categoryId: V['id']) => MemoizedSelector<DaffCategoryStateRootSlice<V, W>, W[]>

Selects products by category id.

selectTotalProductsByCategory (categoryId: V['id']) => MemoizedSelector<DaffCategoryStateRootSlice<V>, number>

Selects the total number of products in a category.