@shopify/shop-minis-react
Version:
React component library for Shopify Shop Minis with Tailwind CSS v4 support (source-only, requires TypeScript)
36 lines (30 loc) • 864 B
text/typescript
import {useShopActionInfiniteQuery} from '../../internal/reactQuery'
import {useShopActions} from '../../internal/useShopActions'
import {
PaginatedDataHookOptionsBase,
PaginatedDataHookReturnsBase,
Shop,
} from '../../types'
export interface UseFollowedShopsParams extends PaginatedDataHookOptionsBase {}
interface UseFollowedShopsReturns extends PaginatedDataHookReturnsBase {
/**
* The followed shops returned from the query.
*/
shops: Shop[] | null
}
export const useFollowedShops = (
params?: UseFollowedShopsParams
): UseFollowedShopsReturns => {
const {getFollowedShops} = useShopActions()
const {skip = false, ...restParams} = params ?? {}
const {data, ...rest} = useShopActionInfiniteQuery(
['followedShops', restParams],
getFollowedShops,
restParams,
{skip}
)
return {
...rest,
shops: data,
}
}