コンテンツへスキップ
Yuva subscribe hookメニュー

Yuva subscribe hook

A React hook over the useyuva headless client: the channel's public mailing lists, subscribing from a form with its form token, and the signed-in user's subscriptions with an identity token.

Loading

    プレビューはサンプルデータで動作します。ネットワークもチャネルも不要です。

    インストール

    shadcn プロジェクトで実行してください。ファイルはあなた自身のコードにコピーされます。

    Shell
    npx shadcn@latest add https://useyuva.com/r/use-yuva-subscribe.json

    使い方

    tsx
    import { useYuvaSubscribe } from "@/hooks/use-yuva-subscribe"
    
    const { lists, states, subscribe, setSubscribed } = useYuvaSubscribe({ server, channel })

    Props

    UseYuvaSubscribeOptions

    Prop型
    server?string
    channel?string
    client?YuvaClient
    identityToken?IdentityTokenSource | null
    lists?string[]

    YuvaSubscribeState

    Prop型
    inboxNamestring
    listsClientMailingList[]
    statesRecord<string, SubscriptionState | undefined>
    identifiedboolean
    loadingboolean
    errorunknown
    subscribe(input: YuvaSubscribeInput) => Promise<{ confirmation: boolean }>
    setSubscribed(listId: string, on: boolean, consentText: string) => Promise<SubscriptionState>

    依存関係

    この項目をインストールすると、次のものも追加されます。

    npm パッケージ