UNPKG

@shopify/shop-minis-react

Version:

React component library for Shopify Shop Minis with Tailwind CSS v4 support (source-only, requires TypeScript)

42 lines (36 loc) 1 kB
import {useShopActions} from '../../internal/useShopActions' import {useShopActionsPaginatedDataFetching} from '../../internal/useShopActionsPaginatedDataFetching' import { Product, PaginatedDataHookOptionsBase, PaginatedDataHookReturnsBase, } from '../../types' interface UseCuratedProductsParams extends PaginatedDataHookOptionsBase { handle: string requiredTags?: string[] anyOfTags?: string[] } interface UseCuratedProductsReturns extends PaginatedDataHookReturnsBase { products: Product[] | null } /** * @param options - The options for the query */ export const useCuratedProducts = ( params: UseCuratedProductsParams ): UseCuratedProductsReturns => { const {getCuratedProducts} = useShopActions() const {skip, ...shopActionParams} = params ?? {} const {data, ...rest} = useShopActionsPaginatedDataFetching( getCuratedProducts, shopActionParams, { skip, hook: 'useCuratedProducts', } ) return { ...rest, products: data, } }