Pocket & renderer
useRemovePocketCard
Give one of the product's Pocket cards up
useRemovePocketCard removes a card from the host's Pocket tab:
remove(cardId) resolves once it is gone. Removing a card that is not
present succeeds; a privileged card (one the host placed itself) is refused
and the call rejects. The card's draw handler stays registered, so the product
draws it again if the host ever restores it. Host-only: standalone remove
rejects with HostUnavailableError.
Usage
import { usePocketCards, useRemovePocketCard } from "@use-truapi/react";
function DismissButtons() {
const { data: cards } = usePocketCards();
const { remove, isPending } = useRemovePocketCard();
return (
<>
{cards?.filter((c) => !c.privileged).map((card) => (
<button key={card.cardId} type="button" disabled={isPending} onClick={() => remove(card.cardId)}>
Dismiss {card.cardId}
</button>
))}
</>
);
}<script setup lang="ts">
import { usePocketCards, useRemovePocketCard } from "@use-truapi/vue";
const { data: cards } = usePocketCards();
const { remove, isPending } = useRemovePocketCard();
</script>
<template>
<button
v-for="card in cards?.filter((c) => !c.privileged)"
:key="card.cardId"
type="button"
:disabled="isPending"
@click="remove(card.cardId)"
>
Dismiss {{ card.cardId }}
</button>
</template>API reference
React
function useRemovePocketCard(options?): NamedMutation<void, string> & object;Give a card up: remove(cardId). Rejects for a card the host placed itself (Privileged).
Parameters
| Parameter | Type |
|---|---|
options? | { mutation?: MutationOptions<void, string>; } |
options.mutation? | MutationOptions<void, string> |
Returns
NamedMutation<void, string> & object
Vue
function useRemovePocketCard(options?): NamedMutation<void, string> & object;Give a card up: remove(cardId). Rejects for a card the host placed itself (Privileged).
Parameters
| Parameter | Type |
|---|---|
options? | { mutation?: MutationOptions<void, string>; } |
options.mutation? | MutationOptions<void, string> |
Returns
NamedMutation<void, string> & object