@weahead/react-cookie-consent-hook
    TypeScript icon, indicating that this package has built-in type declarations

    2.0.6 • Public • Published

    react-cookie-consent-hook

    A simple hook for managing cookies for consent.

    Motivation

    We wanted something as simple as a hook to manage consent cookies for our applications. We started using react-cookie but it was too broad for our use case, so this hook is inspired by react-cookie but more narrow in its use-case.

    Features

    • Simple API for reading/writing cookies for consent management

    API

    Component

    CookieConsentProvider

    Wrap your app inside it.

    Hook

    useCookieConsent

    Returns an array, similar to useState, with the first being cookies, an object with all cookies split in key/value pairs, and the second being setCookie, a function for setting a new cookie.

    Install

    npm i @weahead/react-cookie-consent-hook

    DownloadsWeekly Downloads

    1

    Version

    2.0.6

    License

    ISC

    Unpacked Size

    8.69 kB

    Total Files

    10

    Last publish

    Collaborators

    • kjof
    • simptheshrimp
    • mikaelgson
    • michaelzetterberg
    • jonathan-san
    • lofgrenfredrik
    • andolf
    • tomkaar
    • ci-weahead