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

3.0.1 • 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.

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

    Package Sidebar

    Install

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

    Weekly Downloads

    2

    Version

    3.0.1

    License

    ISC

    Unpacked Size

    9.05 kB

    Total Files

    10

    Last publish

    Collaborators

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