@sfdl/sf-cookie-gate
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

Cookie Gate

This is a small React HoC library for gating top level components behind a cookie.

Installation

Install from npm using the package manager of your choice

yarn add @sfdl/sf-cookie-gate or npm install @sfdl/sf-cookie-gate

Usage

The application exposes a minimal API. Essentially it is a bi-directional HoC which pushes down one path or another depending on whether a cookie has been set. A cookie handler function is provided for convenience

Prop Description Type
ApplicationComponent The component to be shown if the cookie is set JSX Element or React.lazy Element
LandingComponent The component to be shown if the cookie is not set JSX Element or React.lazy Element
options An object of options to configure the cookie CookieOptions

CookieOptions

The cookie options object is used to structure and configure the cookie. It has the following key/values

Key Value
cookieName cookie name string
cookieOptions an object of js-cookie options

Package Sidebar

Install

npm i @sfdl/sf-cookie-gate

Weekly Downloads

4

Version

0.0.3

License

MIT

Unpacked Size

21.9 kB

Total Files

23

Last publish

Collaborators

  • kajws
  • davetickle_sfdl