useCollectionItemsCurrentBid

📚 Use this hook to get the current (latest) bid of all the collection items.

❗

VERY IMPORTANT: This hook is currently in an experimental stage.

This means that breaking changes will happen in minor AND patch releases. Use at your own risk. If you choose to rely on this in production in an experimental stage, please lock your version to a patch-level version to avoid unexpected breakages.

The collection will be automatically selected based on url parameters from urlPattern (see MojitoHooksProvider for more details).

The useCollectionItemsCurrentBid hook will return the current bid from all collection items by calling the items API.

Hooks Sample Code

...
import useCollectionItemCurrentBid from "mojito-hooks/useCollectionItemCurrentBid";

function App {
    const { currentBids, isLoading } = useCollectionItemCurrentBid();

    if(isLoading) return <Loader />;

    if(currentBid) return <DrawBid bid={currentBid} />;

    return <div>No bids available</div>
}

Parameters

PropertyDescriptionTypeDefault
collectionItemIDThe collection item ID.String-
slugThe slug of the collection to load. Optional.StringDynamic from page url (see urlPatterns)
pathnamePage url pathname that contains collection slug. Optional.StringThe page url. e.g., getCollectionSlug(props.slug)

📘

pathname can be used to pass the url pathname on SSR.

Result

PropertyDescriptionType
currentBidsArray of bids associated with the collection item ID.MojitoMarketplaceAuctionBid[]
isLoadingDisplay request loading status, provided for convenience.Boolean
errorThe error object for the query, if an error was thrown.Error
refetchA function to manually refetch the query.(options: T) => Promise<U>
queryResultOriginal React-Query query result.QueryResult<T>