Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nine3-cookie-consent

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nine3-cookie-consent

A simplified cookie consent bar for React applications. Forked from https://github.com/Mastermindzh/react-cookie-consent

  • 0.1.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-40%
Maintainers
1
Weekly downloads
 
Created
Source

A small, simple and customizable cookie consent bar for use in React applications. Based on https://github.com/Mastermindzh/react-cookie-consent

Installation

npm install nine3-cookie-consent

Using it

You can import the cookie bar like this:

import CookieConsent from "nine3-cookie-consent";

If you want to set/remove cookies yourself you can optionally import Cookies (straight from js-cookie) like this:

import CookieConsent, { Cookies } from "react-cookie-consent";

Then you can use the component anywhere in your React app like so:

<CookieConsent>
    This website uses cookies to enhance the user experience.
</CookieConsent>

You can optionally set some props like this (next chapter will show all props):

<CookieConsent buttonText="Accept" expires={150}>
    This website uses cookies to enhance the user experience.
</CookieConsent>

One of the props (onAccept) is a function, this function will be called after the user has clicked the accept button. You can provide a function like so:

<CookieConsent onAccept={() => {alert('cookie has been accepted')}}>
    ...
</CookieConsent>

Debugging it

Because the cookie consent bar will be hidden once accepted, you will have to add the prop debug to evaluate styling changes:

<CookieConsent debug>
    ...
</CookieConsent>

Note: Dont forget to remove the debug property for production.

Keywords

FAQs

Package last updated on 17 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc