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

1.11.20 • Public • Published

react

React bindings for @cookie-consent/components

Usage

import React from 'react';
import { CookieConsentBanner } from '@cookie-consent/react';

const Example = ({ children, extraClasses }) => {
  const [ hasAccepted, setHasAccepted ] = React.useState(false);

  const handleAccepted = () => setHasAccepted(true);

  const handleDenied = () => setHasAccepted(false);

  return (
    <CookieConsentBanner
      classes={extraClasses}
      onDenyButtonClicked={handleDenied}
      onAcceptButtonClicked={handleAccepted} 
      showing={!hasAccepted} />
  );
}

Package Sidebar

Install

npm i @cookie-consent/react

Weekly Downloads

1

Version

1.11.20

License

MIT

Unpacked Size

27.8 kB

Total Files

27

Last publish

Collaborators

  • polarpop