સામગ્રી પર જાઓ
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 પૅકેજ