useFavoriteItems

πŸ’Œ Use this hook to get collection items favored by the current user.

🚧

Authentication required to use this hook

The useFavoriteItems hook will return collection items favored by the current user based on the saleType by calling the MarketplaceCollectionItem API.

Hooks Sample Code

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

function App {
    const { favoriteItems, isLoading } = useFavoriteItems();

    if(isLoading) return <Loader />;

    if(favoriteItems) return (
        <div>
            {favoriteItems.map((item) => <DrawFavoriteItem item={item} />)}
        </div>
    );

    return <div>No favorite items available</div>
}

Parameters

πŸ“˜

This hook doesn't accept any parameters.

Result

PropertyDescriptionType
favoriteItemsMarketplace collection items favored by the current user.MojitoCollectionItem[]
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>