Setting the file. One moment.
Subchapter 1.38
references/context-provider/vertical-contexts/bookings/categories.mdMarkdown2 KBView on GitHub
@wix/bookings/context/categoriesRead Importing a Context in Code first. Import only the hook, from .
@wix/bookings/context/categoriesLoads the business service categories and tracks the selected category in the page URL.
import { CategoriesContextProvider } from '@wix/bookings/context/categories';__0: CategoriesContextProviderPropsElementReads the categories state; throws when no CategoriesContextProvider is above.
import { useCategoriesContext } from '@wix/bookings/context/categories';CategoriesContextValue| Property | Type | Description |
|---|---|---|
initialCategoryId | string | undefined | Selected on load when the page URL names no category. |
categoriesPicker | CategoriesPickerFilter | undefined | Shows only the picked categories. |
refreshSignal | number | undefined | Bumped by the editor bundle on realtime data-changes; non-zero refetches, bypassing warmup. |
children | ReactNode |
| Property | Type | Description |
|---|---|---|
categories | V2Category[] | |
categoryItems | CategoryItem[] | |
selectedCategoryId | string | null | |
selectedCategoryIndex | number | |
selectedCategory | V2Category | null | |
selectedCategoryName | string | null | |
hasMultipleCategories | boolean | |
isLoading | boolean | |
hasError | boolean | |
refetch | () => void | |
selectCategory | (categoryId: string | null) => void |
| Property | Type | Description |
|---|---|---|
_id | string | undefined | Category ID. |
name | string | null | undefined | Category name. |
sortOrder | number | null | undefined | Order of a category within a category list. |
| Property | Type | Description |
|---|---|---|
categoryId | string | null | |
categoryName | string | null | |
isSelected | boolean |